How to access EC2 instances on OSX using Terminal

It took me a few minutes to find this information so I am documenting here how to accomplish this:

  1. Download the .pem file.
  2. Place it in a folder and note where you stored it.
  3. Open Terminal.
  4. using cd go to the folder where your .pem file is stored.  EX. cd /Home/User/Desktop
  5. Amazon requires that the private key privileges be set to 400.
  6. Using chmod set the privileges for 400. EX. chmod 400 test.pem
  7. To access using SSH type: ssh -i test.pem ubuntu@amazondnsnamecompute.amazonaws.com
  8. Type in: Yes
  9. That’s it!

Note: You can make simplify frequent connections by placing this in a .sh script.

  • Create a text file.
  • Paste your original command: ssh -i /Home/User/Desktop/test.pem username@amazondnsnamecompute.amazonaws.com
  • Save the text file with the extention .sh
  • Now you can go to the directory with .sh and type: bash filename.sh
Advertisements
How to access EC2 instances on OSX using Terminal

One thought on “How to access EC2 instances on OSX using Terminal

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s