Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up SSH access for an Amazon EC2 instance?

I need SSH access to an Amazon EC2 instance running Ubuntu 10.4. All I have is the Amazon username and password. Any ideas?

like image 598
BetaRide Avatar asked Jun 18 '11 08:06

BetaRide


People also ask

Why can I not SSH into my EC2 instance?

This means either three things: You are using wrong security key or not using a security key. Please look at your EC2 instance configuration to make sure you have assigned the correct key to it.


1 Answers

Basically, you need a private-key file to login into your EC2 via SSH. Follow these steps to create one:

  • Go https://console.aws.amazon.com/ec2/home & sign in to your existing Amazon account.
  • Click on "Key Pairs" on LHS or https://console.aws.amazon.com/ec2/home?region=us-east-1#s=KeyPairs.
    • You should see the list of KEYs generated by you (or during EC2 creation process).
    • Click on "Create Key Pair" if you don't see any or you lost your private-key.
    • Enter a unique name and hit enter.
    • A download panel will appear for you to save the private-key, save it.
    • Keep it somewhere with the file permission "0600"
  • Click on "Instances" on LHS or https://console.aws.amazon.com/ec2/home?region=us-east-1#s=Instances
    • You should see the list of ec2-instances, if you don't see any, then please create one.
    • Click on the EC2 machine and note down the Public DNS address.
  • Open your Terminal (in Linux) and type the following command
    • ssh -i /path/to/private-key root@<ec2-public-dns-address> - the root username has been avoided in the latest releases, based on your distribution select ec2-user or ubuntu as your username.
    • hit Enter
    • That's it.
like image 55
Rakesh Sankar Avatar answered Oct 06 '22 10:10

Rakesh Sankar