Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.
Example use case
- Web application hosting
- Batch processing
- Web services endpoint
- Desktop in the cloud
EC2 Concepts
- Instance Types
- Root Device Type
- Amazon Machine Image (AMI)
- Purchase Options
Amazon EC2 Instance Types
Defines the processor, memory, and storage type Cannot be changed without downtime Provided in the following categories
- General purpose
- Compute, memory, and storage optimized
- Accelerated computing Pricing is based on instance type Some instance types have unique capabilities
Root Device Type
- Instance Store: Ephemeral storage that is physically attached to the host the virtual server is running on
- Elastic Block Store (EBS): Persistent storage that exists separately from the host the virtual server is running on
Amazon Machine Image (AMI)
- Template for an EC2 instance including configuration, operating system, and data
- AWS provides many AMI’s that can be leveraged
- AMI’s can be shared across AWS accounts
- Custom AMI’s can be created based on your configuration
- Commercial AMI’s are available in the AWS Marketplace
Amazon EC2 Purchase Options
- On-Demand
- Reserved
- Savings Plan
- Spot
- Dedicated
Reserved Instances
Provides discounts over the on-demand model when you can commit to a specific period of time. In addition, it provides a capacity reservation for the specific instance type that you specify.
EC2 Reserved Instance Types
- Standard: Highest discount, works for steady workloads
- Convertible: Enables the conversion of attributes, works for steady workloads
- Scheduled: Works for a time window you reserve, good for a predictable workload
Standard Reserved Instance Cost Models
- All Upfront: Entire cost for the 1 or 3 year period is paid upfront
- Partial Upfront: Part of 1 or 3 year cost is paid upfront along with a reduced monthly cost
- No Upfront: No upfront payment is made, but there will be a reduced monthly cost
Savings Plans
- Similar in concept to reserved instances
- Supports compute with EC2, Fargate, and Lambda
- Unlike Reserved Instances, it does not reserve capacity
- Provide savings of up to 72% Comes in 1 or 3 year terms
Spot instances
Spot instances enable you to leverage excess EC2 compute capacity.
- Can provide up to 90% discount over on-demand pricing
- There is a market price for instance types per availability zone called the Spot price
- When you request instances, if your bid is higher than Spot price they will launch
- If the Spot price grows to exceed your bid, the instances will be terminated
- Spot instances can be notified 2 minutes prior to termination.
Dedicated Host
The dedicated host pricing model gives you a dedicated physical server. It will be the most expensive option, but it may be required for either server software licensing or due to a compliance requirement.
Amazon EC2 Purchase Options: instance types
- Standard or Convertible Reserved Instance If you have an instance that is consistent and always needed.
- Spot instances if you have batch processing where the process can start and stop without affecting the job .
- On-Demand Instances if you have an inconsistent need for instances that cannot be stopped without affecting the job, leverage .
- Dedicated Host if you have specific per-server licensing or if you have a compliance requirement for a dedicated server, you should use
- Savings Plan if you are leveraging Lambda and/or Fargate alongside EC2 and want to achieve discounts for 1 or 3 years
- Scheduled Reserved Instance If you have a predictable but not steady workload in EC2.