Sunday, January 3, 2016

Create your 1st Amazon EC2 Instance

7:25 AM Posted by Anuradha Welivita No comments
Have you ever wondered why many applications move into cloud nowadays? Well to run applications which cater to concurrent requests made by multiple clients, it requires the application to scale on demand. Cloud based services provides for this requirement by enabling the application to have re-sizable computing capacity without having to invest on computing hardware up front. Amazon Elastic Compute Cloud which is well known as Amazon EC2, provides re-sizable computing capacity in the Amazon Web Services (AWS) cloud. The advantage of using Amazon Web Services cloud is that you only needs to pay for what you use.
Amazon EC2 web service can be used to launch a virtual machine (VM). This can be used to launch your own virtual server. You can even have thousands of them and create your own data center. Amazon EC2 instances can handle extra traffic which may come into your website by automatically scaling up to add more capacity. All the security and networking settings can also be configured by the creator through the AWS console.  
Getting Started
In this I will explain you the step by step approach in creating a new Amazon EC2 instance and setting up a new virtual machine on it.
Step 1: Go to Amazon Web Services website:
If you do not have an AWS account, click Create an AWS account on the upper right hand corner of the page.
You need to enter your name, email address and other information along with your credit card information to create an AWS account.

Step 2: Login to your AWS account
Click on My Account → AWS Management Console. Enter your email address and password and login to your account.
Step 3: Set up the region you are closest to.
 Click on EC2 Virtual Servers in the cloud, in the AWS management console.
Then it leads to the EC2 Dashboard where you can select the region you are closest to by clicking on the region menu towards the upper right hand side of the Dashboard.
Step 4: Go to step by step wizard to create the EC2 instance from the AWS management console.
Click on “Instances” on the menu towards the left.
There you can see the current EC2 instances that you have, their status and other information. In order to create a new EC2 instance, click on the “Launch Instance” button.
Step 5: Choose an Amazon Machine Image (AMI)
Amazon Machine Images or AMIs are pre-configured templates provided by Amazon for your instances. It provides it own Linux, Red Hat, Ubuntu, Windows distributions. If you are not running very extensive applications you can use the free tier eligible. In case you are running very extensive applications having lot of live users, it is recommended to use one of the premium versions or the actual tier versions. Let’s use the Ubuntu Server 14.04 LTS distribution for this.
Select Ubuntu Server 14.04 LTS from the list of AMIs.
Step 6: Choose an Instance type
In the next screen you are given a list of instance types having varying combinations of CPU, memory, storage, and networking capacity. You need to select the instance with the appropriate mix of resources depending on your application needs. For this we are going to leave the default option selected as it is.
Next click on “Configure Instance Details” button.
Step 7: Configure Instance Details
Here you are given the options to change the number of instances, network, subnet configurations etc. Here we will leave the default options as they are.
Next click “Add storage” button.
Step 8: Add storage
Here you have the ability to change the storage options. The size will be 8   Gigabytes by default and the volume type will be standard. Delete on termination option will be selected by default and it means when you terminate the instance everything related to it will be deleted forever. Here also we will leave the default configurations as they are.
Next click on “Tag Instance” button.
Step 9: Tag Instance
Here you can tag your Amazon EC2 resources with a case sensitive key-value pair. To more about tagging your Amazon EC2 resources refer the link As default you do not need to tag it. Hence let us leave that blank.
Next click “Configure Security Group” button.
Step 10: Configure security group
A security group is a set of firewall rules that control the traffic for your instance. You can add rules here to allow only specific traffic to reach your instance via specific port ranges.
You can either create a new security group or select an existing security group. Create a new security group by any name and give a brief description about the security group.
Then for the types of security groups leave the ssh type as we will need that later to ssh into the virtual machine from your local machine. Also click “Add Rule” button and add another rule which is HTTP. This is to launch a web server inside the virtual machine for your web applications to run.
You can also configure the rules to allow traffic from known ip address only by specifying a custom ip address range or else leave the source as “Anywhere” to accept traffic from any ip address.
Finally click “Review and Launch”.
Step 10: Review and launch
Review the configuration details of your instance and click on the “Launch” button.
Step 11: Create a key pair
Then it requires you to create a key pair which is used when you try to access your instance such as when sshing to your virtual machine from your local PC. You can either use an existing key pair which you have created earlier or create a new pair. Here we will create a new key pair.
Select create a new key pair from the dialog box which appears and give it a name. Click download key pair to download the key pair in the form of a .pem file to your local machine. Store it in a secure location as you will only be able to download it once.
After that click on “Launch Instances” button to launch your 1st Amazon EC2 Instance.
Now you have finished creating your 1st Amazon EC2 Instance. You can view the status of it under “Instances” in the Amazon EC2 Dashboard. It will take a few minutes to fully initialize and run the newly created Amazon EC2 Instance.
In the blog posts which follow I will guide you through how to access your Amazon EC2 Instance from your local PC, host Apache web server and run a PHP web application on it.


Post a Comment