There might be times when you either have something fascinating happening on the Amazon cloud machine that you set up, or – more likely – you got stuck with a problem a friend might be able to help you with. Here are notes on how to set up a shared access for a standard (Ubuntu linux) computer.
If you set up your EC2 machine securely, it will not allow anyone but you to access it though: The “security group” used allows your IP only. (If you set it up insecurely with Source = 0.0.0.0/0 your friend – and anyone else – will be able to access it directly!) There is however the option to modify this security group, and after a few minutes delay it will be applied even to running machines! So all you need to do to allow your friend to work alongside of you is to add his IP address and add his public SSH key:
Part 1 (see screenshot below):
- Find out the additional IP address, e.g. with www.iplocation.net/find-ip-address from your friend’s computer, e.g. 22.214.171.124
- Go to the EC2 management console
- In the navigation pane, choose Network Interfaces.
- Select the network interface and choose Actions >> Edit inbound rules
- Add a new SSH rule with the additional IP address, e.g. 126.96.36.199/32 and save it.
- copy his public SSH key to the machine (using your own private key):
scp -i "~/.ssh/your-key-region1.pem" friends_key.pub email@example.com:~/
- log into the machine (with your own private key):
ssh -i "~/.ssh/your-key.pem" firstname.lastname@example.org
- add the new key to your existing keys:
cat friends_key.pub >> .ssh/authorized_keys
He can now log in with his own (private) key:
ssh -i "~/.ssh/friends_key.pem" email@example.com
This description was based on this help page.