AWS

AWS EC2

Category: Compute

AWS Elastic Compute Cloud, more commonly known as EC2 is one of the core services offered by AWS. At a very basic level, EC2 are virtual machines. These virtual machines can be used as servers of various kinds – web servers, application servers, CDNs, jump servers, etc.

Cloud computing offers various advantages and one of them is that the maintenance of these cloud resources is managed by the cloud providers themselves. AWS guarantees high availability of these resources and they are modeled around “pay-as-you-use” constructs. In this post, we take an overview of EC2 services by AWS.

AWS EC2 instances are managed virtual machines, meaning they are similar to hardware servers or computers. However, since they are virtual, there are ways to access these machines based on which operating system they host.

AMI

Talking about operating systems, EC2 instances cannot be created without AMIs i.e. Amazon Machine Images. AMI defines the operating system of the EC2 instance along with additional software components if any. It is impossible to create a virtual machine without selecting a choice of AMI.

Whether your EC2 instance hosts a Windows OS or Linux distribution – is defined by AMI. Many software vendors build their own AMIs and add them to AWS Marketplace for their customers to use. For example, you may find an AMI which has prebuilt support for Tomcat or Kubernetes and so on. In these cases, there is no need for you to carry out additional installation steps to install these software components.

Various types of AMIs exist, which you can use to create an EC2 instance. There are as below:

  1. Amazon Quick Start AMIs
  2. AWS Marketplace AMIs
  3. Community AMIs
  4. Private AMIs

Amazon Quick Start AMIs are provided by Amazon and they are highly accessible in the process of creating an instance. Generally, they are free to use and are generic. You may need to do some additional configurations to suit your needs.

AWS Marketplace AMIs are not free. Certain software vendors have their software licensed. In these cases creating an AMI which supports their software involves a certain cost of the license. In such cases, they publish their AMIs to AWS Marketplace where customers can agree to pay their costs before using these AMIs. Using these production-ready images incurs additional costs.

There are many Community AMIs built and available on AWS to be used. Given the fact that anybody can create their own AMI by taking a snapshot of the system, it becomes very easy to contribute to the AMI ecosystem. These are publicly available AMIs that are built by AWS customers.

Finally, organizations build their own AMIs to support their infrastructure projects. These AMIs are private and not available for everybody for use.

Instance Types

EC2 instances to be created on AWS needs certain inputs in terms of sizing. Memory, CPU, network requirements, etc. define the type of instance to be created – or let’s say it’s the other way around. Based on which size you choose, the costs are calculated.

There are pre-defined sizing templates that are provided by AWS to be selected while creating an EC2 instance. Currently, you cannot provide custom values for these parameters. The sizing templates are grouped based on the type of performance they support. They are as follows, the names are self-explanatory.

  1. General purpose
  2. Compute optimized
  3. Memory optimized
  4. Accelerated computing
  5. Storage optimized

Based on the template you select, your instance will be allocated with appropriate resources and billed accordingly.

Tenancy

AWS data centers are located in various regions and every region has 2 or more availability zones. Data centers are huge facilities where server infrastructure is installed in large numbers. These infrastructures consist of all the types of hardware that support various cloud services that are provided to users by AWS.

Whenever a user requests for any resource using AWS management console, the hypervisor provisions the resources by segregating a slice of this infrastructure. It is quite more complex than it sounds.

Tenancy defines what kind of hardware is allocated to your instance and it also has implications on the cost. AWS operates EC2 instances in 2 types of tenancy model – shared tenancy and dedicated hosts.

In the shared tenancy model, the hardware resources allocated to an instance are shared with other customers. In the sense, when a particular EC2 instance is destroyed/terminated, the resources allocated to it are returned to the pool from where they would be allocated to other customer instances.

In a dedicated host model, the hardware allocated for your EC2 instance is dedicated to itself. Whenever a dedicated host is used, its hardware cannot be shared with other customers. Of course, this is a bit expensive than a shared tenancy.

Pricing

In addition to the type of instance and tenancy model chosen, there is one more aspect that affects the overall cost of the EC2 instance. This aspect is based on whether you want to book the instance infrastructure for the long term or you just need it for a while and let go of it.

These are also called reserved and on-demand instances. In situations where you want to spin up an environment where certain virtual machines are going to live forever, you can always go for reserved instances. Reserve instances are always associated with a long-term duration plan which is around 3 years. You commit to use (or pay for) the instance for 3 years minimum.

By committing to such a timeline, you can reap the benefit of the lesser price for the same kind of on-demand instance. For example, if you spin an on-demand instance for 3 years straight, and compare it with the cost paid for a reserve instance for 3 years – you would notice that there is a considerable saving in the case of a reserve instance.

Any architecture which needs long-term systems should go for reserved instances.

Storage

EC2 instances come along with root storage volumes. While launching an instance you get to select the type of storage to be used. Additional storage blocks can also be added. EC2 instances can also make use of Elastic Block Storage (EBS) which we shall cover in another post.

You can select the type of volume to be used and the size. By default, the root volume size is specified as 8 GB and the type as General Purpose SSD, you can modify the same. This is a mandatory block storage every instance is associated with.

However, the default instance storage that it comes up with is ephemeral. When the instance is terminated, the storage is also put back into the pool of available resources. So the data stored on this storage volume is lost. In the case of EBS, the data storage is preserved even when the instance is terminated and it has quite a few uses which we would go through in another post.

EC2 instances are going to be constantly discussed when dealing with various core services of AWS. This is just an overview of EC2, however, there are many configuration details which we would go through in the future.

Categories:AWS, Compute

Tagged as: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s