【Backend】How to use SSH to connect remote AWS EC2 instance (using Local Terminal & FTP)

Chengcheng Hsu
3 min readMay 19, 2023

--

The way of SSH is similar to the Windows Remote Desktop Connection. It allows you to connect to your remote computer by entering specific informations. Now, let’s attempt to connect to our EC2 instance.

source: https://www.technipages.com/create-rdp-shortcut-icon/

Assuming that you have already created an EC2 instance and have an SSH Key file.

  • My EC2 platform setup version: Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0–1033-aws x86_64)

Find your instance informations first

On this page, make sure your instance is running and passes checks status. Then choose an instance and click ‘Connect’.

Next, click on the SSH client tab. You can find your instance informations.

Method 1: Local Terminal

Open your local terminal and type the following SSH commands:

ssh -i [key-location] [username]@[host-location] 
// example
ssh -i ~/Desktop/personal/ec2-key/for-api-test.cer ec2-user@xxxx-xxx-xxx.us-east-2.compute.amazonaws.com

Sometimes, you need to protect your key by using chmod 400 [key-location] in this situation below.

If you have problem, you should check the format of your key file and make sure to type correct format. If you see the picture below, it means you have successfully entered your EC2 instance.

Method 2: FTP

Sometimes, we need a GUI to perform actions easily. So, go to website FileZilla and download the app. After open this app, click the button on the navigation bar and click ‘New site’.

  1. Choose SFTP-SSH File Transfer Protocol in Protocol
  2. In Host, you type your ‘host location’
  3. ‘Logon Type’, choose ‘Key file’.
  4. User: type username
  5. Key file: select your key file.

Then, click ‘Connect’. If you can see your Remote site, means you successfully entered your EC2 instance. 🙌🏻 🙌 🙌🏻

Other resoures:

Remote Development using SSH

--

--