Sunday, 28 February 2016

Launching and connecting to your new EC2 instance of your Amazon web service


In AWS you can start your own virtual machine and work with it. All you have to do is go to -
and create your free account. Note you will have to provide your credit card details and as a part of verification process they will cur 2/- rs from your account. But don't worry it will get refunded to your account in 3-4 business days. I am going to skip this part where you create your account - it is very straightforward after you visit above URL. In this post we will see how to get the EC2 instance which is the basic free tier up and running.

Launching EC2 instance

Once you log in your dashboard should look as below - 

Click on the EC2 (Virtual server in the cloud). You should see EC2 dashboard

Click on "Launch Instance" to start the launch configuration. Note the "instances" link on the left. We will visit it once our EC2 instance is up and running.

Next you will have to choose which OS to boot up. I am selecting Ubuntu server 14.04 LTS which is a part of free tier. You can choose the OS you want.

Next you will have to select the instance type. Select t2.micro  with 1 CPU and 1GB mem.

Now click on Configure Instance Details. Keep the defaults you see and proceed to storage settings.

Next go to Tag Instance. This is where you name your EC2 instance.

I have name it athakur-webserver. You can name it whatever you want. You will see this in instances tab later.

Next go to configure security groups. Here you can configure which IPs can access the EC2 instance. Default group is which mean all IPs can access it. I am going to keep it as such.

Next click on "Review And Launch". You will get a screen with details of all configurations you have done so far. Review it and select Launch.

Before your instance is actually launched you will need to create a pair of public and private key that will enable you to connect to your EC2 instance. Basically you will have the private key (used on machine you use to connect remotely to your EC2 server) and EC2 server has the public key. You can download your private key (it will be a .pem file) and save it on your local machine.

 So create your key and "Download Key Pair" and finally launch your instance.

It may took some time for your EC2 instance. Once it is up you are good to go. You can go to dashboard and select the instances link I referred to in 2nd screenshot.

You should see your instance details here. You can also note the public DNS that is basically your hostname.

Connecting to your EC2 instance

Now you can SSH to your EC2 instance from your local machine. To know the steps right click on your running instance and select connect. You should see steps to connect via ssh.

Follow the steps provided in -
to connect to your EC2 instance via putty. You will have to convert your pem file to ppk file and give it as input to putty for connecting. PuTTY has a tool named PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert your private key into this format (.ppk) before attempting to connect to your instance using PuTTY.

 Once you are done you should be able to connect -

In Linux or Mac you can simply SSH to your machine.

Note you will have to provide appropriate permissions for your pem file. For details you can refer -
NOTEYour public DNS or your hostname will change every time you reboot your instance. To get a permanent IP address, click Elastic IPs in the AWS Management Console (left navigation bar), allocate a new IP address and associate it with your instance.

Related Links

t> UA-39527780-1 back to top