All About AWS EC2
Many a times, we are not aware of the computing power we might require for running our applications and we end up either over-estimating our requirement and buying stacks of servers which will not be of any use, or under-estimating our usage, which may lead to the crashing of our application. So to overcome this problem, AWS EC2 comes into play. Today, in this article, we’ll have a deep dive on AWS EC2 service.
What is AWS EC2 ?
Amazon Elastic Compute Cloud(EC2) is a virtual machine that represents a physical server for us to deploy our applications. Instead of purchasing our own hardware and connecting it to a network, Amazon gives us nearly unlimited virtual machines to run our applications while they take care of the hardware.
EC2 instances are highly scalable, allowing us to select instances with different resource configurations of CPU, memory, storage, and networking as required. It is pretty easy to launch, stop and terminate an instance.
It comes with unique features like resizable compute capacity in cloud, auto-scaling capabilities(scaling up or down as many instances as we want), load balancing( distributing traffic across multiple servers) and offers complete control over computing resources. We can also choose Operating System of our choice such as Windows, Linux or Mac.
Also, instances come from Amazon Machine Images (AMI). These machine images act as a template that configures an operating system and determines the operating environment of the user. The users can also configure their own AMIs. So, when we want to launch an instance we have to specify which AMI we want to use. It could be Ubuntu, windows server etc.
EC2 Instance Types
There are different types of EC2 instances that are optimized for different use cases. Each instance type delivers a mix of CPU, memory, storage, and networking capacity. Let’s discuss about them one by one.
- General Purpose:
These instances are great for diversity of workloads such as web servers or code repositories. They have a good balance between compute, memory and networking.
Use Cases:
Developing, building, testing, and signing iOS, iPadOS, macOS etc. - Compute Optimized:
These instances are great for compute intensive tasks that require high performance processors i.e. lot of processing from CPU
Use Cases:
Batch processing workloads, high performance computing(HPC), video encoding, gaming, machine learning tasks , analyzing data from data streams etc. - Memory Optimized:
Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory.
Use Cases:
High performance, relational or non-relational databases, in-memory caches, and real time big data analytics - Storage Optimized:
These instances are great for storage intensive tasks that require high, sequential read and write access to large data sets on local storage.
Use Cases:
High frequency online transaction processing(OLTP), relational and NoSQL databases, cache for in memory databases
Benefits of AWS EC2
- Elastic Web-Scale Computing:
Amazon EC2 enables us to increase or decrease capacity within minutes. Moreover, we can begin one, 100s, or even 1000s of server instances in parallel. - Reliable:
Amazon EC2 offers 99.9% availability for each Amazon EC2 region. The services are highly reliable where replacement of instances can be done easily and rapidly. - No Long term commitment:
You’re paying by the hour. You pay for whatever you use, instead of paying for the whole computing cloud.
- Complete Control:
We have complete control of our instances. We have root access to each one, and we can interact with them as you would any machine - Flexible Cloud Hosting Services:
We have the choice of multiple instance types, operating systems and software packages. It allows us to select a configuration of memory, CPU, instance storage, and the boot partition size. - Cost Savings:
It saves us lot of cost by allowing us to pay only for capacity that we actually use and amount of time we consume.
EC2 Instance Launch Types
- On-Demand:
With on-demand instances, we pay for what we use. It has the highest cost and no upfront payment. These are recommended for short term and un-interrupted workloads where we can’t predict how application is going to behave.
We can increase or decrease the capacity depending on the demand of the application and only pay for the specified hourly rate of instance.
These are mainly used for short workloads and have predictable pricing. - Reserved Instance:
These are the instances which we reserved beforehand. While reserving, it is mandatory to reserve for min 1 year. Here, we reserve a specific instance type. It is recommended for long workloads, steady state usage applications. We can reserve for 1 or 3 years.
Reserved instance are subdivided into 3 categories:
1. Standard RI: These RIs are used for steady stage usage. They offer a discount of up to 75% off .
2. Convertible RI: These RIs provides capabilities to change EC2 instance types. They offer a discount up to 54% off.
3. Scheduled RI: These are available to launch within time windows which is reserved by the user. - Spot Instances:
This is the most cost efficient instance in ec2 which are mainly used for short workloads, available at the highest discount of up to 90%, but we can loose instances if the price we pay is less than the current price.
Very useful for workloads that are resilient to failure. Use cases: Batch jobs, data analysis, image processing, distributed workloads but NEVER run critical jobs on spot instances because we may loose instance anytime. - Dedicated Host:
It is a physical server with ec2 instance capacity, fully dedicated for our use. It can address compliance requirements and reduce costs by allowing
to use existing server bound software licenses. It’s just like renting entire server in data center of AWS.
These are a bit pricier than others and are allocated for 3 year period reservation - Dedicated Instance:
These are instances which are running on hardware that’s dedicated to us.
It may share hardware with other instances in same account and we have no control over instance placement.
I hope you enjoyed this deep dive into AWS EC2. In the next article, we’ll learn how to launch our first EC2 instance. Feel free to drop me a message if you face any issue!
Happy Learning!