PolarSPARC |
AWS Elastic Compute Cloud (EC2) - Quick Notes
Bhaskar S | *UPDATED*12/14/2023 |
AWS Elastic Compute Cloud
AWS Elastic Compute Cloud, also referred to as EC2, is a cloud service that provides a secure and auto scalable compute capacity in the cloud.
The following is the summary of the various features/capabilities of EC2:
Provides virtual computing environment known as Instances
Reduces time to provision and launch new instances
Allows one to quickly scale capacity up or down
Pay only for the capacity used
Allows one to build failure resilient applications
Instance(s) are provided as preconfigured templates and are called Amazon Machine Images (or AMIs for short)
AMI is a virtual image that packages the desired operating system and necessary software package(s) that is Region specific
When an AMI is copied from one Region to a second Region, it automatically creates a Snapshot in the second Region
Provides different configuration of instances that are optimized for CPU, memory, storage, and networking and are known as Instance Types
Allows one to securely login to instances using asymmetric keys known as Key Pairs
Storage volumes called Elastic Block Store (or EBS for short) can be attached to instances for storing data
Provides a virtual firewall called Security Group that enables one to specify the protocols, ports, and source IP ranges that can reach an instance
EC2 Instance Types
AWS provides a large variety of EC2 Instance Types to choose from based on one's workload needs.
EC2 provides the following types of instances:
Type | Description |
---|---|
General Purpose | Provides a balance of compute, memory and networking resources, that can be used for a variety of general workloads |
Compute Optimized | Suitable for compute bound applications that benefit from high performance processors, that can be used for batch processing, media transcoding, high performance computing (HPC), machine learning, etc |
Memory Optimized | Delivers fast performance for workloads that process large data sets in memory |
Storage Optimized | Designed for workloads that demand fast access, low latency I/O operations for processing large data sets |
Accelerated Computing | Make use hardware accelerators or graphical processing units (GPUs), that can be used for demanding workloads such as high-performance computing (HPC), artificial intelligence, etc |
EC2 Purchasing Options
EC2 provides the following Purchasing Options for Instances:
On-Demand
Pay a fixed price by the second
No long-term commitments or up-front costs
Better for short-term, irregular, uninterrupted workloads
Savings Plan
Upto 72% savings on the On-Demand price
One or three year commitment
Commitment to a consistent amount of usage (in USD per hour)
Reserved
Commitment to a consistent instance configuration, such as, instance type, Region, Tenancy, Platform
One or three year commitment
Significantly lower hourly rate
Better for applications with steady predictable workloads
Spot
Upto 90 percent savings on the On-Demand price
Allows one to bid on unused EC2 computing capacity at steep discounts
Bid by specifying a maximum price willing to pay. Instance is launched when the spot price is lower than the specified maximum price
Will continue to run until terminated or the spot price exceeds the specified maximum price
If the spot price exceeds the specified maximum price, the instance will receive a two-minute notification before it is terminated
Better for applications that have flexible start and end times
Dedicated Hosts
Physical EC2 server for dedicated use
Allows one to use existing per-socket, per-core, or per-VM software licenses
Helps in cases where there is a need to meet compliance and regulatory requirements
Dedicated Instances
Run on hardware that is dedicated to a single customer
May share hardware with other instances from the same AWS account
EC2 Fleet and Spot Fleet
EC2 Fleet and Spot Fleet allow a user to launch a group of compute Instances on AWS.
The following are some of the features:
Launch multiple Instance Types
Take advantage of a mix of On-Demand, Reserved Instances, Savings Plan, and Spot Instances
Allows one to optimize costs through the use of Spot Instances
Automatically distributes instances evenly across multiple Availability Zones within a Region for resiliency
Automatically request replacement Spot Instances if they are interrupted
Elastic IP Address
Elastic IP is a public static IPv4 address that can be assigned to a single Instance.
The following are some of the features:
Remains static and does not change over time
Incurs an hourly charge whether it is used or not
One can mask the failure of an Instance by rapidly remapping it to another Instance
For use in a specific Region only
All AWS accounts have a quota of FIVE (5) Elastic IP addresses per Region
Placement Groups
For certain workloads that have a need for a group of interdependent Instances, one can create a Placement Group and attach it to Instances to influence their placement.
The following are the three types of Placement Groups:
Cluster
Packs all the Instances in a single Availability Zone
For workloads that have a low-latency network performance requirement
Spread
Distribute a group of Instances that are placed on different racks in an Availability Zone
Racks can also be on different Availability Zones in the same Region
Partition
Spreads Instances across different logical segments called Paritions (in different racks) in multiple Availability Zones in the same Region
There can be a maximum of SEVEN (7) Partitions per Availability Zone
Number of Instances that can be launched in a Partition is limited to the limits of the AWS account
Elastic Network Interfaces
Elastic Network Interface is a logical networking component and represents a virtual network interface card.
The following are some of the features:
Each Instance is assigned a default Elastic Network Interface, referred to as the Primary Network Interface and cannot be detached from an Instance
One can create and attach additional secondary Elastic Network Interfaces to an Instance
Can have a primary private IPv4 and one or more secondary private IPv4
Can associate one Elastic IP address per private IPv4 address
Can associate one public IPv4 address
All IPv4 addresses must come from the Subnet it resides in
Bound to a Subnet in an Availability Zone in a Region
Security Groups
A Security Group behaves like a virtual firewall in EC2 Instances and controls incoming and outgoing network traffic.
The following are some of the features:
Are Region specific
Is bound to the ENI of the Instance
An Instance can have one or more Security Groups associated with it
By default all inbound traffic is blocked while all outbound traffic is allowed
Rules are only of type ALLOW
Rules enable one to filter traffic based on protocols and port numbers
Rules can be all added or removed at any time and they take effect immediately
For Instances with multiple Security Groups, all the rules are aggregated before being applied
EC2 Instance Store
EC2 Instance Store is an ephemeral, high-performance physical hardware storage disk which can be attached to an Instance.
The following are some of the features:
Ideal for temporary storage of information that changes frequently, such as caches, scratch data, and other temporary content
Size as well as the number of devices available varies by Instance Type
Can be attached only at Instance launch and NOT after launch
Exists only during the lifetime of the Instance
Data does not persist if the Instance is stopped, hibernated, or terminated
References