Listed below are the steps for creating and connecting to new EC2 instance on AWS. For this example we are going for a new Ubuntu micro instance which is part of the AWS free tier list.
Step 1: Sign in to your AWS account page.
Step 2: Click My Account/Console drop down available on the top right hand side and select AWS Management Console from the list.
Step 3: In the Services page, navigate to Compute & Networking section and click EC2 instance. This should open the EC2 dashboard page as shown below.
Step 4: Clicking on the Launch Instance button would display the following Create a New Instance screen.
Step 5: Provide a name for your instance, key pair and choose Ubuntu Server 12.04.2 LTS under Launch Configuration. After downloading key pair to your local system, click the Continue button. Then click the launch button to launch your instance.
Connecting to EC2 instance
Step 1: Navigate to your AWS EC2 Dashboard and choose the appropriate running instance. In this example we are going with the Ubuntu t1.micro instance.
Step 2: Now click the Actions drop down and select Connect from the drop down list.
Step 3: In the Connect to an instance screen, click the Connect with a standalone SSH client.
This should provide you with details for connecting to EC2 instance with a standalone SSH client.
Step 4: Open a new terminal window (on Mac and Cygwin on Windows) and type in the command line statement.
ssh -i raviaws.pem firstname.lastname@example.org
make sure to replace AWS key pair and instance with your details. ssh -i <key pair><instance details>
You might see the above “Permission denied (publickey” error if you have not navigated to folder where you had downloaded the AWS key pair for the EC2 instance.
Step 5: Also make sure to give appropriate file permission for key pair file to avoid the permission error using chmod function.
Then try again the command line statement again to connect to the EC2 instance. Now you are ready to use the newly created EC2 instance.
In case you are doing a trial of AWS EC2 instance then make sure stop or terminate the instance after your trial usage to avoid incurring any cost for the usage.