Bitzu

SAA-C03 ยท Cost-optimized compute

EC2 vs Fargate vs Lambda: how each one bills

Cost models of EC2, Fargate and Lambda for steady versus spiky workloads, and edge or on-premises options such as Outposts where they fit.

Key points

  • EC2: pay while running, busy or idle; cheapest highly utilized with Savings Plans or RIs.
  • Fargate: requested vCPU and memory, per second, 1-minute minimum (Linux); Fargate Spot for interruptible tasks.
  • Lambda: per request + GB-seconds at 1 ms, nothing idle, 15-minute limit.
  • Spiky or idle traffic: Lambda; steady high traffic: right-sized EC2 or Fargate + Compute Savings Plan.
  • On premises (latency, data residency): AWS Outposts.

Source: https://aws.amazon.com/fargate/pricing/

Practice questions

Single choice

What does AWS Lambda charge you for?

  1. Requests plus duration in GB-seconds
  2. Each hour a function is deployed
  3. The vCPUs reserved for the account
  4. A flat monthly fee per function
Show answer

Answer: A. Requests plus duration in GB-seconds

Lambda bills the number of requests plus duration measured in GB-seconds (memory times execution time), rounded to 1 ms. There is no charge for provisioned servers or for idle time between invocations.

Select all that apply

Which statements about AWS Fargate pricing are correct?

  1. Charges are based on the vCPU and memory the task requests
  2. Linux tasks are billed per second with a one-minute minimum
  3. Each task includes 20 GB of ephemeral storage at no extra cost
  4. You pay for the underlying EC2 instance hours of the cluster
  5. Fargate Spot is available for Windows container tasks on ECS
Show answer

Answer: A. Charges are based on the vCPU and memory the task requests, B. Linux tasks are billed per second with a one-minute minimum, C. Each task includes 20 GB of ephemeral storage at no extra cost

Fargate bills the vCPU and memory a task requests, per second with a 1-minute minimum for Linux, and every task includes 20 GB of ephemeral storage. You never pay per underlying EC2 instance, and Fargate Spot on ECS is Linux only.

True or false

Because it has no idle charges, AWS Lambda is always cheaper than Amazon EC2, whatever the traffic pattern.

Show answer

Answer: False

False. Lambda wins for spiky or mostly idle traffic, but at steady, high request volumes the GB-seconds add up, and a well-utilized, right-sized EC2 or Fargate fleet with a Savings Plan can cost less.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More SAA-C03 topics in this module