How to connect to a new Amazon LightSail node via ssh in one command
You can follow the instructions on this tutorial if you just want to ssh into your node and be done with it
The end result of that tutorial is running the following command to ssh into your LightSail instance:
ssh -i /path/to/private-key.pem username@public-ip-address
Keep reading if you want to just ssh into your server with one word/command.
Follow the instructions on the tutorial until Step 3.
Once you have the private key downloaded, move it to your .ssh
directory.
mv ~/Documents/LightsailDefaultKey-us-west-2.pem ~/.ssh
Continue following the AWS LightSail tutorial up until Step 3.3.
Now we will configure our ssh access so we can just run a one word command.
If you don’t have a local ssh key yet follow this tutorial or google it.
Go to your terminal again:cd ~/.sshvi config# Once you are in this file create a new Host blockHost my-server
HostName domain-or-ip-goes-here
User bitnami
PreferredAuthentications publickey
IdentityFile ~/.ssh/LightsailDefaultKey-us-west-2.pem
Now let’s try running the command:
ssh my-server
If you are successful you will be logged in to your instance and see the Bitnami welcome logo!