Skill 4.2.3
Determining cost-effective AWS compute services with appropriate use cases (for example, AWS Lambda, Amazon EC2, AWS Fargate)
Key Concepts
Lambda bills per request and per GB-second of duration, scales to zero and has a free tier, so it is cheapest for spiky, infrequent or event-driven workloads. At consistently high utilisation it can cost more than EC2. Graviton (arm64) Lambda functions cost less per GB-second.
Fargate bills per vCPU and GB per second for running tasks with no idle instances to pay for; Fargate Spot gives up to 70% off for interruptible tasks. EC2 is most cost-effective for steady, high-utilization workloads, especially with Savings Plans, Reserved Instances or Spot, and for workloads needing specific instance types or licensing.
Purchasing options: On-Demand (flexible), Savings Plans (Compute: up to 66% off across EC2, Fargate and Lambda; EC2 Instance: up to 72% for one family and Region), Reserved Instances (up to 72%), Spot (up to 90%, 2-minute interruption notice), Dedicated Hosts (BYOL per socket/core) and On-Demand Capacity Reservations (capacity guarantee, no discount on their own).