InterviewHubPRO
Section Overview
Q22

Question 22 of 65

Part 3: Compute, Containers & Serverless (21 - 35)

34%
AWS Cloud Architecture•Part 3: Compute, Containers & Serverless (21 - 35)

EC2 Pricing Models comparison.

In Simple Words:

  • On-Demand: Pay by the second with zero commitment. Most expensive.
  • Savings Plans / Reserved Instances: 1- or 3-year commitment for steady workloads; up to 72% discount.
  • Spot Instances: Spare AWS capacity with up to 90% discount. AWS can reclaim instances with a 2-minute warning. Great for fault-tolerant batch workers and CI/CD runners.
hcl
# EC2 Launch Template requesting Spot Instances:
resource "aws_launch_template" "worker" {
  instance_market_options {
    market_type = "spot"
    spot_options {
      max_price = "0.05"
      spot_instance_type = "one-time"
    }
  }
}