Connecting to EC2 using the terminal on MAc/Linux

  • The terminal is already installed by default. You just need to open it up.
  • You do not need to convert to a .ppk file. Just use the same key as downloaded from AWS.
  • Change directory into the loacation where your PEM file is. Most likely will be in the Downloads folder
cd ~/Downloads

IMPORTANT – Anywhere you see these anchor tags < > , going forward, it means you will need to replace the content in there with values specific to your situation. For example, if we need you to replace the name you have saved the private key on your machine, we will write something like < private-key-name >.

If the private key you downloaded was named my-private-key.pem simply remove the anchor tags and insert my-private-key.pem in the command you are required to execute. Lets try this and follow the instructions below to get some work done.

  • Change premissions for the private key file (.pem), otherwise you can get an error "Bad permissions"
sudo chmod 0400 <private-key-name>.pem
  • Connect to the instance by running
ssh -i <private-key-name>.pem ubuntu@<Public-IP-address>
written by
Segun

Liked this article?

Stay updated with our latest articles, subscribe to our newsletter

You may also like

Darey Blogs

Uncategorized

project-3

Leke
  • 5 min watch
Darey Blogs

DevOps Career

What Is In The Cloud?

Dare Olufunmilayo
  • 5 min watch
Darey Blogs

DevOps Career

DevOps! Where do I Start?

Igor Suchilov
  • 5 min watch