Amazon Elastic Compute Cloud (EC2) provides secure, elastic compute capacity in the cloud. You can think of it like you are renting a piece of a huge server where you can spin up your own independent instances catered to your specific needs.
With EC2, you don’t have to spend time or resources obtaining new server resources. It allows you to boot up a new server instance in just minutes, and you can quickly scale to capacity as computing requirements change, and only pay for what you use.
EC2 utilizes virtual computing environments, called Instances, and they can be customized for CPU, memory, storage, and networking capacity (Instance Types).
The data is stored in multiple physical locations called Availability Zones, which then exist within Regions. This helps with redundancy and speeding up user access.
There are many preconfigured templates/images to help spin up an EC2 Instance in seconds, called Amazon Machine Images (AMIs). They package everything you need to stand up and run a server including OS and additional software. I stood up this WordPress website by using a WordPress AMI.
Learn how to create a WordPress Website with EC2.
- EC2 Instance Store : Temporary storage volumes for data that’s deleted when the Instance is stopped or terminated
- Elastic Block Store (EBS): Persistent storage volumes (that’s not deleted when the Instance is terminated)
- Elastic File System (EFS): Scalable file storage that can serve as a common data source for workloads running on multiple Instances
- Simple Storage Service (S3): Inexpensive object storage
There are 4 different options when paying for EC2 instances, depending on the budget and need.
- Low cost and no commitment
- Pay fixed rate by the hour or second
- Use Case
- Applications with short term or unpredictable workloads that cannot be interrupted
- Bid for a price for instance capacity
- Saves money for needs with flexible start and stop times
- Use Cases
- Applications with flexible start/stop times that need to be very cheap
- When there is urgent need for large amounts of additional computing capacity
- Reserve capacity at significant discount on hourly charge at 1 or 3 year terms
- Make up-front payments to reduce costs: Standard/Convertible/Scheduled RI
- Use Case
- Applications with predictable usage or steady state that require reserved capacity
Types of Reserved Instances
- Standard RI
- Up to 75% discount
- Convertible RI
- Up to 54% discount
- Can change attributes as long as the resulting RI is equal or greater value
- Scheduled RI
- Launch within a reserved time window
- For predictable, recurring schedule that requires only fraction of a day/week/month instead of running consistently
- Physical dedicated servers
- Reduce costs by using pre-owned server-bound software licenses
- Can be purchased On-Demand (hourly), or Reserved for up to 70% off
- Use Cases
- Regulatory requirements that doesn’t allow multi-tenant virtualization
- Licensing that doesn’t support multi-tenant/cloud deployments
EC2 Instance Types
- F1: field programmable gate array
- I3: high speed storage
- G3: graphics intensive
- H1: high disk throughput
- T2: lowest cost, general purpose *
- D2: dense storage
- R4: memory optimized
- M5: general purpose
- C5: compute optimized
- P3: graphics/general purpose GPU
- X1: memory optimized
- T3: burstable general purpose (brand new as of 8/21/18)
Numbers indicate the Generation. T2 is the most economical and commonly used instance.
You can learn about all the different instance types on the Amazon EC2 Instance Types KB.
- Placement Group names must be unique within your AWS account, despite the type.
- You should keep the EC2 instance types homogeneous within Placement Groups
- You can’t merge Placement Groups
- You can’t merge existing EC2 instances into Placement Groups
- Cluster Placement Group: grouping of EC2 instances inside a single AZ
- Low network latency, high network throughput
- Only certain instances can be launched into Clustered Placement Group
- Spread Placement Group: grouping of EC2 instances each on distinct and separate hardware
- For applications with small number of critical instances that need to be separate
- Across multiple devices and AZs