[Tips] – How to do a SSH in an AWS instance ?

 

How I lost enough time to be able to understand what was wrong or missing I decided to write this post. Also, I didn’t find a practical material.

You need a pair key

You need to create a key that must be saved in your computer to use to have access. You will set up it when you launch your instance. Important : You can’t change it after create your instance. This will be set in the last step.

  • Go to : NETWORK & SECURITY >> Key Pairs >> Create Key Pair 
  • Save this key in your local environment ( Ex: ~/.ssh/my.pem )
  • Use the chmod command to make sure your private key file isn’t publicly viewable.

chmod 400 ~/.ssh/my.pem

+ Info : http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html

You need a security group that allow ssh

  • Go to : NETWORK & SECURITY >> Security Groups >> Create Security Group
  • In your group you must add the role : SSH allowed

Example :

screen-shot-2016-10-07-at-3-46-20-pm

+ Info : http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html

EC2 – Launch your instance with the configs

  • Go to : Instances >> Launch Instance 
  • Set up the security group :

screen-shot-2016-10-07-at-3-49-58-pm

  • Set up the key pair : ( It is in the end after Launch Button )

screen-shot-2016-10-07-at-3-51-03-pm

Now you can do the SSH

ssh -i /path/my.pem publicDNS

+ Info :

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

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