Skip to content

Connect AWS Lightsail SSH with ubuntu terminal

In configuring an AWS LightSail environment, I encountered a frustratingly annoying issue attempting to connect to the new server using ssh from the terminal window using my Ubuntu desktop.

In this post, I'll detail the steps I used to overcome this frustrating issue in the hope I help others to avoid the frustration.

What is AWS Lightsail

If you've found this post, chances are you already know what AWS Lightsail is and are already experiencing the issue, but it's worth explaining what AWS Lightsail is for the uninitiated.

Amazon Lightsail is the easiest way to get started with AWS for developers who just need virtual private servers. Lightsail includes everything you need to launch your project quickly – a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP – for a low, predictable price.

It's convenient service to use, if like me you want to set up a small staging or test site or even just looking for somewhere to host a Proof of concept web application etc.

It enables you to spin up websites quickly without having to configure all the equivalent EC2 instances etc.

Connect to LightSail with ubuntu ssh

The documentation for LightSail is fairly comprehensive and the guys at amazon have tried to make it as easy as possible for developers to make use of LightSail, which is probably one of the reasons why I am quite disappointed this is even an issue.

I have been using ssh from the terminal for a few years and even run my own ProxMox virtual environments in my home office so I am very used to connecting to machines via the terminal.

It's a really convenient way to get things done quickly. Like everything else it takes some getting used to but you soon find your way.

When you create a LightSail instance, you can connect to your machine using the web-based ssh tool, which for the most part works well.

The downside to using the web tool is that it does require you to open a browser, log in to your account etc to access it.

Sometimes this can be a real PITA and it's often simpler to ctrl + T to open a new terminal window and connect.

The instructions provided by AWS to connect via ssh, seem all the pertain to Windows users and require the installation of PuTTY. On Ubuntu ssh comes as default and is all terminal based.

My first assumption was that despite Lightsail providing me with a default key, which I could download the default key. The reality is, I didn't really want to download the key to my machine, I wanted to be able to use my existing SSH key.

I tried uploading public key using the SSH key pair management form and the form accepted it just fine.

I attempted to connect via SSH like normal using simply


Take note

{LIGHTSAIL_IP_ADDRESS} is just a place holder and you should replace with the IP address of your Light Sail server

However, the result returned was


I thought this was strange, as this is usually how I connect to machines, so thought there must be an issue with firewalls etc.

So I spent 15 minutes checking settings etc internally and on Web ssh client, couldn't really find anything. I'd be the first to admit, that although I know my way round, there is probably loads more I don't know, so I could just as easily overlooked the obvious.

In the end the only way I could actually connect to the machine was to download the Default Key provided. Placed it in my ~/.ssh folder.

Originally I thought I could just use chmod and assign it the same permissions as my but that didn't seem to work. So the only permissions that seem to work are as below

Connect to your Light Sail server using SSH

I was then able to connect to the LightSail server using ssh and the following terminal commands

Take note

{LIGHTSAIL_IP_ADDRESS} is just a place holder and you should replace with the IP address of your Light Sail server


Which was great, but I really didn't want to try and remember that every time I wanted to connect.

So what I was able to do was use standard ssh way of copying information, because I had already uploaded my public key via portal. I could use the following command to set authorised acccess.


Which worked well and now I am able to connect using



The above is an approach I used to enable SSH to a AWS Lightsail Ubuntu server. Once SSH was enabled I deleted the default key from my Workstation in order that I don't have it lying around!

If anybody knows of a better method please let us know in the comments below.

Gary Woodfine
Latest posts by Gary Woodfine (see all)