Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save atikbhatti/1edef1765836c7ed02f8daae1cf2b768 to your computer and use it in GitHub Desktop.
Save atikbhatti/1edef1765836c7ed02f8daae1cf2b768 to your computer and use it in GitHub Desktop.
Download the .pem file.
In Amazon Dashboard choose "Instances" from the left side bar, and then select the instance you would like to connect to.
Click on "Actions", then select "Connect"
Click on "Connect with a Standalone SSH Client"
Open up a Terminal window
## Create a directory:
# mkdir -p ~/.ssh
Move the downloaded .pem file to the .ssh directory we just created:
# mv ~/Downloads/ec2private.pem ~/.ssh
Change the permissions of the .pem file so only the root user can read it:
# chmod 400 ~/.ssh/ec2private.pem
Create a config file:
# vim ~/.ssh/config
Enter the following text into that config file:
Host *amazonaws.com
IdentityFile ~/.ssh/ec2private.pem
User ec2-user
Save that file.
Use the ssh command with your public DNS hostname to connect to your instance.
e.g.:
# ssh ec2-54-23-23-23-34.example.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment