Setting up SSH with VS Code for Amazon Lightsail

By Marcin
May 5, 2020
3 min read

Installing Remote SSH in VS Code

Install Plugin:
Remote - SSH

It will include a configuration plugin as well. But to login, you’ll need 2 things

  1. username
  2. PEM file

I'll also show you

  1. where your bitnami app password is located
  2. if you're using WordPress, where your public files are located

Finding Your Credentials


Lightsail seems to use Bitnami containers. Make sure you're using the right username for your container. For a WordPress container, your username is bitnami (at time of writing). The full username for ssh will be this



Go to the section of the Amazon Lightsail site with access to ssh and instance management. 

Scroll down and find the public key 
Download this
Store it in the same folder with your .ssh config.
On my Mac, that location is 


on my PC this location is


Enter all this into the ssh config file. It should be formatted roughly like this:

Host {an arbitrary label for users to select this host}
HostName {enter your ip address from above}
User {enter your username from above}
Identity File {the path to your PEM file}

Example config file:

Host MyTestSite
HostName 11.234.567.23
User onewithux
IdentityFile ~/.ssh/tot.pem


You shouldn't need this password but it might be needed elsewhere, beyond he scope of this short guide.

Open the virtual ssh terminal available from your Lightsail instance and type:

cat bitnami_application_password

bitnami_application_password is where the password is stored. This file may change in the future. Copy/paste this password temporarily in case you need it.

Setting Up Config in VS Code

I thought this video was pretty good, and the YouTuber uses a funny intonation. I set the video to play at the 1 minute mark, which is where he shows you how to create the initial config file.

Now, just in case that video gets deleted, I'll note the steps here.

  1. click on the Remote - SSH in the left toolbar of VS Code
  2. on the "SSH Targets" dropdown menu, click on the "+" icon
  3. enter the following ssh command, without quotes "ssh {username}@{ip address}", for my example above that would be "ssh bitnami@11.234.567.23"
  4. click on the first location that appears. on my computer that's that is "users/martin/.ssh/config"
  5. your new Lightsail host will appear below the "SSH Targets" dropdown, click on the new window icon located in the new host file's selection area
  6. at this point, you may be running into an error pertaining to the PEM file's permissions.

Updating Your PEM File's Permissions

Now, this is close to working, but you may have received a permissions error.
You have to change the permissions to either 400 or 600.

Open terminal to the location of the PEM file.
Type in the following

Chmod 400 {your pemfile.pem}

for me that looked like

chmod 400 tot.pem

use 400 if you’ll change the PEM file rarely (more likely)
use 600 if you’ll change it more often

That's It!


I'm using WordPress and need to find the relevant public files to begin making changes. They're located here




No Comments.