To normally access any EC2 instance using SSH, you would require a private-key file. Follow the steps below to create a private-key:
First, log on to your existing AWS account and open your EC2 dashboard
Click on "Key Pairs" on the left-hand side or go to this link https://console.aws.amazon.com/ec2/home?region=us-east-1#s=KeyPairs.
You would see a number of key pairs created for your EC2 instances
Create a new key if your private key is lost or if you don’t have any
Enter a unique name and hit enter.
Now you would see a download panel for the private key, now download and save it
Keep it somewhere with the file permission "0600"
After that, Click on "Instances" on the left-hand side or https://console.aws.amazon.com/ec2/home?region=us-east-1#s=Instances
You will be seeing already created instances or create one
Choose an EC2 machine, copy the public DNS address
Open your Terminal (in Linux) and type the following command
ssh -i /path/to/private-key [email protected]<ec2-public-dns-address> - Choose the user or just provide “ubuntu” which is the common password for Ubuntu machines to begin with
And now it is done.