What is AWS EC2?
Amazon Elastic Compute Cloud (EC2 ) is a service, that Amazon web services offers, that allow users to rent virtual computers on a public cloud, on which they can run their own computer applications. By using this service, developers can create instances of virtual computers and can configure the capacity scaling of instances using the EC2 web interface.
EC2 provides a web service through which a user can boot an Amazon Machine Image to configure a virtual machine, which Amazon calls an instance. An Amazon Machine Image(AMI) includes an operating system, apps, and configurations.
The term elastic exists because a user can create, launch and terminate server instances as needed.
Generally, EC2 is priced on per instance per hour basis. However, any instance can be rented out on a per month basis as well.
Steps to set up EC2 on Amazon Web Server
Step 1: Sign in to the AWS management console and open the AWS Lambda console.
Step 2: Under the Services tab, Click on EC2 under the Compute section. This will take you to the page where you can create Amazon EC2 instance.
This page also contains the following sections :
This section has the following subsections :
Running instances: This indicates the number of EC2 instances that have been created by the user and are currently running.
Elastic IP’s :
This subsection allows the user to generate Elastic IP’s and associate it with an EC2
Elastic IP’s are static public IP’s that do not change even when an instance with which it is associated is restarted or stopped ..When you associate an Elastic IP with an EC2 instance it replaces its default public IP address.
Dedicated Hosts :
This subsection allows you to allocate a dedicated host for your EC2 instances.
Amazon EC2 dedicated hosts are servers with virtual machine capacity which are dedicated to only one AWS customer. In this case, the server capacity is not shared with other customers. This allows you to launch EC2 instances on the same dedicated host over time.
AWS Customers use EC2 dedicated hosts to meet strict compliance and regulatory requirements or to preserve software licenses.
This subsection allows you to create EBS Snapshots of your EBS volumes.
Amazon elastic block store (EBS ) is an AWS service that provides block storage for your EC2 instances. This essentially means that it provides hard drives to your cloud computers.
A very useful function of Amazon EBS is creating EBS snapshots of your EBS volumes.
An EBS snapshot is a backup or a copy of the data in your EBS volume.
It is a good disaster recovery solution for your EBS volume.
If you want to backup your EC2 instance, then you can create EBS snapshots of the EBS
volumes attached to the instance.
This subsection allows you to create EBS volumes.
An EBS volume is a storage device that you can attach to a single EC2 instance. Once a volume is attached to an instance, you can use it like any other physical hard drive.
You can use EBS volumes as a primary storage of data that requires frequent updates or for applications that require continuous disk scans.
Load Balancers :
This subsection allows you to create Load Balancers.
Elastic load balancing allows you automatically distribute incoming application traffic across multiple EC2 instances. It enables you to achieve fault tolerance in your applications providing the required amount of load balancing capacity needed to route application traffic.
Key Pairs :
This subsection allows you to create Key pairs.
Amazon EC2 uses public – key cryptography to encrypt and decrypt login information.
Public – key cryptography uses a public key to encrypt a piece of data, such as a password, then the recipient uses the private key to decrypt the data. This set of public and private keys is known as a key pair.
To log in to your instance you must create a key pair, specify the name of the key pair when you launch the instance and provide the private key when you connect to the instance.
Security Groups :
This subsection allows you to create security groups.
Security groups act like your cloud firewall to protect your applications and data. They allow you to control the inbound and outbound traffic of one or more EC2 instances.
When you launch an instance, you can associate one or more security groups with that instance.
Placement groups :
This subsection allows you to create placement groups.
Placement groups are logical groupings or clusters of instances in the selected AWS region. Group members are able to communicate with one another in a way that provides low latency and high throughput.
Step 3: Launch Instance
To create an AWS EC2 instance click on Launch Instance button.
This will take you to a page which allows you to choose an Amazon machine image.
Amazon machine image is like templates that are configured with an operating system and other software, which determines the user’s operating environment. Each AMI includes a template for the root volume required for a particular instance. A typical example of an AMI might contain an operating system, an application server, and applications.
You can select an AMI provided by AWS, their user community, AWS marketplace, or you can select one of your own AMI’s.
Step 4: Choose an instance type :
Amazon EC2 allows you to choose from a wide selection of instance types which are optimized for various use cases. EC2 instances give you the flexibility to choose the right mix of resources for your applications. Instance types consist of varying combinations of CPU, Memory, storage and networking capacity.
Step 5: Configure Instance :
Now, click on the Next: Configure Instance Details which takes you to a page which allows you to configure your instance further.
Step 6: Add Storage
In the Configure Instance Details page, click on Next: Add storage button. This will take you to a page where you can configure storage device settings.
This page allows you to do the following :
- Attach additional EBS volumes and instance store volumes to your instance
- Edit the settings of the root volume
Step 7: Add Tags
In the Add storage page, click on Next: Add tags button. This will take you to a page where you can Add tags.
A tag consists of case sensitive key-value pair.
A tag is a label that you assign to an AWS resource. Tags enable you to categorize your resource in different ways. They are useful when you have resources of the same type.
Step 8: Configure security group
In the Add tags page, click on Next: Configure Security Group button. This will take you to a page where you can configure security group for your EC2 instance.
A Security Group is a set of firewall rules that control the traffic for your instance.
Step 9 :
In the configure security group page, click on Review and the launch button.
This will take you to a page where you can review your instance launch details. You can also go back to edit changes for each section.
You can click on Launch button in this page to assign a key pair to your instance and complete the launch process.