Create Amazon Elastic Compute Cloud (Amazon EC2)

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.

You can read more about ec2 here : Adminlogs-amazonEC2

I would like to document how I have created an instance in amazon and successfully logged in to shell. Amazon ec2 will not allow password authentication , it will support only key authentication.

1) Login to your amazon account ( or create a new account )

2) Create an EC2 instance

Once you have logged in using your account , you can see a well organized admin panel . From here you can create ,edit ,monitor and delete your instances

From admin panel , Select EC2 and appropriate region you wish to host your instance . Once you selected these two things then you can press the button “launch instance ”

3) Select appropriate OS for your instance( Choose an AMI )

Here I have selected 32 bit CentOs from the Community AMI’s

4) Select the type of instance ( Ram and CPU )

I have selected the small instance with 1.7Gb ram and 1 cpu.  You can select any one of the following spec.

Next step is to setup the Advanced Instance options, you can keep the default settings as it is.  Also in this step you can specify whether you want to use amazon detailed monitoring.

5) Add tags to your Instance

6) Create a keypair

As I have told before amazon will not allow password authentication. You can give a specific name for your key.  And there is an option to create and download your key file (.pem format ). You should keep this in a safe place. If you are creating multiple instances you can use the same keypair or generate new keys for each instance.

7) Configure Firewall.

In this steps you can configure access control for your server . For example allow port 22 only from your network , allow http port 80 to public etc.  Your settings will be saved as security rule. Just like keypair , you can use a default security group for your all the instances or you can write specific firewall rules .

8 ) Review

Your ec2 instance configuration is over, In this step you can review your configurations and make necessary changes if  you need.

If you are ok with the current configurations then you can proceed with ” Launch ” Instance . This will create an instance for you with the given specifications. ( It will take 2-3 minutes to complete this )

9) Manage an Instance

Once the instance is created , then you can view the instance in the admin dash board. From here you can stop/start/reboot your instance just like a normal linux server.

From the Instance tab you can view your newly created instance . This will give you basic details of your instance like instance name , id etc.

If you want to know about more about your instance just click on the instance and this will display a detailed info about your instance just show above.

In the above diagram , I have projected ” public dns ” , this is your server ip/hostname to connect remotely to the server. By default amazon will not give you a public IP . Next step

I will describe how to setup a public ip for  your instance.

10 ) Create additional volume and setup a new public IP

By default for the “small instance ” type amazon will give only 10Gb disk space . We can add additional volumes and attach to the corresponding instance.  Also we can add public ip  to your instance using the tab ” Elastic IP’s ” . Note that if you restart , the public ip will be detached automatically . So each time you need to attach public ip after a reboot.  Also note that after each restart you will get a different public DNS name and private ip . Once you added/attached  a public ip and this ip will be stable .

Now everything is fine with the EC2 configuration.

11) Remote login to the newly created Instance.

We need to create/generate a public and private key pair using the security key (.pem) generated through amazon admin panel ( Refer step 6 )

To generate the key pairs , we can use the software putty gen . Load the amazon key to putty gen and save public and private keys in to a safe place.

12 ) Configure putty to use private key authentication.

Use the “public dns ” ( If you are purchased/added a elastic ip then you can use that ) as the hostname/server ip in putty and point the corresponding private key to putty as follows

Once you setup the putty as above then you can connect to the server/instance using root.

Here may be you have noticed /dev/sdb with 147Gb space. Actually its a free space given by amazon . But please note that whenever you restart the instance all the data’s in this drive will be lost.  If you want additional space other than /dev/sda1 , then you should create new volumes using the admin panel and attach to your instance.

Yes , you have successfully created your own ec2 instance. Now you can work on the server just like a normal linux server. Enjoy !! 🙂