How do I connect to my Amazon Lightsail instance?


Connecting to your Amazon Lightsail instance depends on whether you ordered a Linux or Windows server. Follow the guide below for instructions on how to connect.

How to connect to Linux instance

Select your Amazon Lightsail instance from the My Services page in My NodeSpace.
31244e42cfc27dd247c3b1077e08372fbfe29177?t=851580ef6096e25db6c486d625b65db1
Select Connection Details.
c5e6705aa319df694c72a08353927a895ef9ca71?t=880c38bb1ddbe1369a2ec9deb662d55d In the connection details box, take note of the following: (2) IP Address that you will be connecting to, (3) the username that you will use to connect, (4) the private key, and (5) the certificate key. Please follow the detailed instructions for the computer you are currently using.
ee48954698fc2fea051b7acd4c75d2a26b431814?t=2d616e23965787127b34dc5758e88081

macOS / Linux

Copy the SSH Private Key (4) and open a new text editor document and paste it in. We use Sublime Text, but you can use a text editor of your choice. Do not use Microsoft Word, LibreOffice Writer, or OpenOffice Writer. It should look something like this:

288c4246b7748a8181b361012788420438c1c441?t=7e889bdbafd3fdc99944a61c813499fb Paste your private key into the text editor and save it to either your Documents directory or, ideally, ~/.ssh/ directory. Give the key a filename that you can remember. Save the file without an extension. In this example, we're saving the key as "nodespacelightsail". 
85c43c4dd0a0168db64b8edc244ccf37544581c0?t=b1ac0f181102e1c46ddcfb7ee32d5d19 Now, go back to My NodeSpace and the connection details. Copy (5) SSH Cert Key and paste it into a new text editor file. It should look something like this:
0f51a798c2d285cf61e157ad5b8469e213ad4c12?t=012a49aed848d63d07ba67c46ef6dab4 Now save it to the same directory to where you saved your SSH Private Key. Name this file the exact same thing you called your private key, but with a .pub extension. If you do not save it to the same location or with the same file name, you will not be able to connect! 

For example, I saved my private key in my Documents directory called "nsls-test". I'll save my public key as "nsls-test.pub" and also place it in my Documents directory.

Secure your private key

Before we can connect, we need to secure our private key. 

Using your file manager (GUI)
If you're using your file manager, go to where you saved your private key file. Alternate click on it and select properties (or for macOS, Get Info). Find the file permissions. Remove all access to the file other than for your user account. For macOS users, click the padlock at the bottom and authenticate. Select any other user or group and press the "-" button. If you cannot remove a group, select the privilege and choose "No Access". For your user (identified by "(Me)"), make sure Read & Write is selected. It should look like the following. Click the padlock again to prevent changes from being made.
b619ad2749f7da120dfa81d99338429506a6c895?t=141e009d0664d4ab0ac8de52852143b5
Using your Terminal (Command Line)
If you prefer, you can use your Terminal. Open up your Terminal application (applies to both Mac and Linux), and navigate to where your private key is. For example, when I open my terminal, I am already in my home directory so I just have to type the command cd Documents/ and press return and I'm in my Documents directory.
1c3847edf3bc5367ad7def6270d1d30b739ebd6c?t=66fdd70f7484148926a68c8723524090 Then issue the following command, replacing "PRIVATEKEY" with the file name of your private key that you specified when you saved it.
chmod 600 PRIVATEKEY
For example, I saved my private key as "nsls-test" so I'd type in chmod 600 nsls-test and press return.

Connecting to your Instance

In your terminal, now type in ssh [email protected] -i PRIVATEKEY if you saved your private key in ~/.ssh/. If you saved it in your Documents directory, navigate there first by using the command cd Documents. Once you're in the location where you saved your private key, run the previous command, replacing USERNAME with the username, IP with the IP address of your instance and PRIVATEKEY with the name of your private key. You may be asked to add the remote system to your known hosts file. Select Y or YES. You're now connected to your instance!
2de32a2955f13d55cb6769bbbae77cd4f65acae8?t=4978e66372655e7e30ff7c431789a5ea

Windows (PuTTY)

Instructions coming soon.


Comments

  Add Comment

Confirm Submission

Please enter the text from the image in the box provided; this helps us to prevent spam.