How do I enable SSH access for an AWS EC2 instance ?

This sneppet teach you the steps that need to be followed to enable SSH access for an AWS EC2 instance.

Steps to enable SSH access for an AWS EC2 instance

You can use Secure Shell (SSH) from Linux, Windows, macOS to connect to AWS EC2 instance. First, you need to enable SSH access for EC2 instance. The following are the step by step procedure to achieve the same.  

1: First, go to https://console.aws.amazon.com/ec2/home and sign in using your AWS account.

2: Then, click “Key Pairs” on the left hand side or the use the URL in browser https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#KeyPairs:

  • You can check list of keys created already. 
  • Click “Create key pair” button if you don’t create one already. 
  • Enter unique name for example, “EC2Tutorial”.
  • The Key pair type you can choose “RSA”
  • The key format can be either .pem or .ppk. Choose .pem if you are using Linux / macOS / > Windows 10. Else choose .ppk if you are using < Windows 10 for example Windows 7/8.
  • Then you can download the key and  save it somewhere in your machine.
  • Please make sure you have given right file access permissions.

3: Next, click “Instances” on the left hand side or use the URL https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#Instances: 

  • You should see EC2 instances created already.
  • If you haven’t created, please create one and note down the public Public IPv4 address. 

4: Finally, open the terminal/ windows command prompt and try the following SSH command ssh -i EC2Tutorial.pem [email protected]I am using Windows 10 to try SSH access.

Make sure that EC2Tutorial.pem is accessible while running the above command. Also please note, I have used “ec2-user”. The username would be based on the distribution that you choose while creating EC2 instance.

C:\Users\sneppets\aws>ssh -i EC2Tutorial.pem [email protected]
   ,     #_
   ~\_  ####_        Amazon Linux 2023
  ~~  \_#####\
  ~~     \###|
  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023
   ~~       V~' '->
    ~~~         /
      ~~._.   _/
         _/ _/
       _/m/'

That’s it. You had learnt how to setup/configure SSH and do SSH access using Windows 10. 

Hope this is helpful.

You’ll also like:

References

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments