In Part 1 of this series, I showed you how to create a user and provide him privileges to do stuff in AWS. Now we move ahead and try creating EC2 instances. To create EC2 instances, first we need to have a “Key Pair” which would enable us to ssh into the EC2 instance. To create a Key Pair -
1) Go to AWS console -> EC2 -> Key Pairs -> Create Key Pair.
2) Provide a name, create Key Pair and download the pem file.
3) Change the permissions of pem file to 400.
Now, create a security group -
1) Go to AWS console -> EC2 -> Security Groups -> Create Security Group.
2) Provide a name and description.
3) Click on Add Rule. In Type, select SSH. In Source, select My IP if you have a static IP, else select Anywhere. Click Create.
Now, let’s create the EC2 instance -
1) Go to AWS console -> EC2 -> Instances -> Launch Instance.
2) Select “Ubuntu Server 14.04 LTS”. Keep the default settings till Step 4.
3) In Step 5, provide a name to the instance, so that we can identify this instance from the list of EC2 instances in the console.
4) In Step 6, choose “Select an existing security group” and select the security group created above. Click Review and Launch.
5) Now click Launch and select the Key Pair which we have created before.
Now go to AWS console -> EC2 -> Instances. Select the instance which you just created and copy its Public IP from the panel below.
Assuming that you have followed everything from Part 1 of this tutorial series, go to command line and do -
ssh -i <path_to_pem_file> ubuntu@<public_ip_of_ec2_instance>
You should be logged into the EC2 instance.