EC2 Basics
Elastic Compute Cloud (EC2) is an infrastructure as a service offering from Amazon Web Services. EC2 gives you the ability to rent virtual machines, store data on them, distribute load across machines and automatically scale services up or down based on demand or traffic.
EC2 allows you to rent Windows, Linux and MacOS servers and also choose servers based on RAM, CPU, storage capacity, network card type and other characteristics. There are four classes of EC2 instances, namely general purpose, compute optimised, memory optimised, and storage optimised instances.
General Purpose Instances
These are great for diverse workloads such as running web servers, code repositories, virtual desktops and small databases. They offer a balance between compute, memory and networking. T and M class instances such as t2.2xlarge
and m7g.large
are in this category.
Compute Optimised Instances
Compute optimised instances are for workloads that benefit from high performance CPUs. This category of instances is ideal for media transcoding, high performance web servers, scientific modelling and machine learning, dedicated gaming servers and batch processing workloads. The C class of instances such as c7g.4xlarge
fall into this category.
Memory Optimised instances
Memory optimised instances are designed to deliver the best performance for workloads that process lots of data in memory(RAM). This makes them ideal for in-memory databases such as Memcached or Redis, applications performing real-time processing of big unstructured data and high performance databases.
R (e.g r7g.medium
), X (x2iezn.2xlarge
) and Z (z1d.3xlarge
) class instances are in this category.
Storage Optimised Instances
Storage optimised instances are great for storage-intensive tasks that require high, sequential read and write access to large data sets on local storage. Use cases for these include high frequency transaction processing systems, databases, data warehousing applications and distributed filesystems. These instances come in the I , D and H classes.
EC2 Purchasing options
AWS offers five different ways to pay for EC2 instances:
- On demand
- Reserved
- Savings plan
- Spot instances
- Dedicated
On demand Instances
On demand instances are the most expensive instances that are billed per second or per hour. They have no upfront payment and no long-term commitment. They are recommended for short-term uninterrupted workloads where you can’t predict how the application will behave.
Reserved Instances
These type of instances allow you to reserve instances with a specific attributes such as the type of instance, region or OS for a period of 1 or 3 years. They can be paid for upfront and cost much less than on demand instances. They are recommended for steady-state applications such as databases. AWS offers Convertible Reserved Instances which are reserved instances that allow you to change attributes of. With these instances, you could change such things as instance type, family OS, scope and tenancy.
Savings Plan
This plan gives you a discounted rate for on demand instances if you commit to a certain type of long term usage e.g $10/hour for 1 or 3 years. Once you purchase this plan, you’re locked to a specific instance family and AWS region. It is flexible across instance size, OS and tenancy.
Spot instances
This plan can get you discounts of up to 90% compared to on demand plans and are the cheapest instance types. The catch is that you have to bid for them and if someone else outbids you or if the price of the instance gets higher than what you paid, you lose the instance. Its the most cost efficient type of instance but it isn’t reliable and so it isn’t suitable for critical jobs or databases. It can be used for the following types of workloads:
- batch jobs
- image processing
- distributed workloads
- workloads with a flexible start and end time
Dedicated Hosts and Instances
When you purchase a dedicated host from AWS you have access to the physical server itself to yourself. Dedicated hosts allow you to use your existing server-bound software licenses and are ideal in situations where compliance requirements require a dedicated server. These types of instances don’t come cheap.
Dedicated instances are similar, they run on hardware that is dedicated to you but you may share the hardware with someone else. With dedicated instances, you have no control over instance placement and no control over the entire server.
EC2 Capacity Reservations
This type of plan allows you to reserve on-demand instance capacity in a specific availability zone for any duration. They ensure you always have EC2 capacity when you need it and are ideal for short term uninterruptible workloads.
Top comments (0)