Connecting to AWS Lightsail via SSH on the Mac

Having just set up an Amazon AWS Lightsail instance, I hit a little bit of a pothole when trying to connect via SSH on my Macbook Pro using the terminal. I hope I can save you a few minutes by documenting my experience.

The instance that I set up was the a Bitnami LAMP stack. The Lightsail control panel is pretty simple, with just a few options, one being how to connect to the server. You can use the built in SSH session window that runs in the browser, but I’m guessing that’s intended for configuration and not for file upload via scp. For that, you’ll want to use your own client.

Referring to the the screen shot above, if you click the ? next to the test Connect using your own SSH client, you’ll be shown instructions on how to connect to the instance using PuTTY. PuTTY, of course, doesn’t run on the Mac.

Further, the Lightsail instructions only address PuTTY and specific configuration of that client. Thanks guys.

Part of those instructions are to download the private key in the Account section. That part, anyway, is required on all clients.

However, if you follow the instructions as described above, you won’t be able to connect. Because you are connecting to the Bitnami instance, other rules apply. That is not made clear, of if it is, I sure missed it.

You need to follow the instructions from the Bitnami documentation.

Once you download the private key and copy it to your .ssh folder, you’ll need to change the permissions, like so.

[code]chmod 600 /Users/youraccount/.ssh/LightsailDefaultPrivateKey.pem[/code]

Then, you’ll need to include the path on your ssh command, as well as the -i flag, which means that you are specifying a private key.

[code]ssh -i /Users/youraccount/.ssh/LightsailDefaultPrivateKey.pem bitnami@00.000.00.000[/code]

This works. The Lightsail instructions are, shall we say, immature.

Posted in AWS

Leave a Reply

Your email address will not be published. Required fields are marked *