To access an instance you will need to use ssh. Linux and macOS support this in the terminal. On Windows you can use WSL or PowerShell.
-
Locate the keypair that you downloaded from AWS when you started your instances.
-
Find the IP address of the instance you would like to connect to. This will be shown if you click on a instance from the list you have created. In the example below the ip address is
54.210.24.40
-
Open a terminal.
-
Copy the keypair to your
~/.ssh
folder usingcp keypair.pem ~/.ssh/keypair.pem
wherekeypair.pem
is the path to the downloaded keypair (note - the keypair generated by AWS is given in a .cer file for macOS. Can be used in exactly the same manner as the .pem) -
WARNING MAKE SURE YOU TYPE THIS COMMAND EXACTLY AS SHOWN Set your key to have the correct permissions by running
chmod 0600 ~/.ssh/keypair.pem
. -
Use the command
ssh [email protected] -i ~/.ssh/keypair.pem
. Replace the IP address with your IP.
You now have a terminal connected to your AWS instance (example on Sion's machine shown below)
The best way to transfer files between your local machine and the instance is to use a git repo for your work and clone the repo to the AWS instance. To learn how to use git follow this guide.
Alternatively, consider using scp. The command to copy my_stuff.zip
into the home directory on your EC2 instance will be something like scp -i ~/.ssh/keypair.pem my_stuff.zip [email protected]:~
. Replace the IP address with your IP and my_stuff.zip
with the file you want to copy. This method is a frustrating as you will need to zip and unzip stuff all the time.
Another option is to use a GUI based FTP program. (WinSCP)[https://winscp.net/eng/index.php] is a great option for Windows users. I cannot recommend FileZilla in good faith FileZilla as some vendors bundle it with Malware!! However, I assume if you install with apt from the Ubuntu repos it will be ok (have not tested this!)
Amazon have published this handy guide