概念 · 基于 CLF-C02
EC2, Lambda and Fargate cost
Compare compute by utilization: busy and steady favors servers, idle and bursty favors serverless.
本课尚未翻译,暂以英文显示。
你在云从业者中已学过
- EC2 gives you servers to manage.
- Fargate runs containers without servers.
- Lambda runs functions, billed per run.
EC2
- Cheaper when
- Busy and steady
- Watch out
- Idle capacity bills
Fargate
- Cheaper when
- No servers, moderate use
- Watch out
- Pay for requested size
Lambda
- Cheaper when
- Bursty or rare
- Watch out
- Constant load adds up
| Service | Cheaper when | Watch out |
|---|---|---|
| EC2 | Busy and steady | Idle capacity bills |
| Fargate | No servers, moderate use | Pay for requested size |
| Lambda | Bursty or rare | Constant load adds up |
CloudFront Functions
- Runs
- Short JavaScript
- Saves
- Lowest cost per run
Lambda@Edge
- Runs
- Heavier code
- Saves
- Origin trips
Outposts
- Runs
- AWS in your site
- Saves
- Transfer and latency
| Edge option | Runs | Saves |
|---|---|---|
| CloudFront Functions | Short JavaScript | Lowest cost per run |
| Lambda@Edge | Heavier code | Origin trips |
| Outposts | AWS in your site | Transfer and latency |
是什么
Lambda bills per request and per GB-second (memory times run time). It costs nothing while idle, so it wins for spiky, event-driven or low-volume work. A function that runs all day at high volume can cost more than a small always-on instance. Memory also sets CPU, so more memory can finish sooner and cost the same or less: test a few sizes. Functions on Graviton cost about 20% less per GB-second.
是什么
Fargate bills vCPU and memory per second while a task runs. You pay for what you request, not what you use, so size tasks well. Fargate Spot gives up to 70% off for interruptible tasks. Containers on EC2 (Amazon ECS or Amazon EKS) can pack many containers on one busy instance. That is cheapest at high, steady use, but you manage the servers and pay for empty space. Microservices help utilization, because each service scales alone instead of scaling a whole monolith. Compute Savings Plans cover EC2, Fargate and Lambda.
是什么
Edge processing can cut transfer and origin load. CloudFront Functions run very short JavaScript on viewer requests at the lowest cost. Lambda@Edge runs heavier code and can also run on origin requests. AWS Outposts processes data next to its source, which cuts transfer and latency, but you pay for the rack.
要记住
- Bursty or rare: Lambda. Steady and busy: EC2 or Fargate with a commitment.
- Lambda cost = requests + GB-seconds. Test memory sizes. Arm costs less.
- Fargate: you pay for requested vCPU and memory. Fargate Spot is up to 70% off.
- Compute Savings Plans cover EC2, Fargate and Lambda.
要记住
- Containers on a busy EC2 fleet can beat Fargate at high steady use.
- Edge: CloudFront Functions for light work, Lambda@Edge for heavier, Outposts for local processing.
考试中
- “Runs a few times a day, pay nothing when idle” points to Lambda.
- “Containers, no servers to manage, interruptible” points to Fargate Spot.
- “Runs 24/7 at high utilization, lowest cost” points to EC2 with Savings Plans or Reserved Instances.
- “Simple header rewrite at the edge, lowest cost” points to CloudFront Functions.
别和这些弄混
本任务内容 · 4.2
- Purchasing options compared
- Reserved Instances in depth
- Savings Plans in depth
- Spot design
- Dedicated Hosts and tenancy
- Rightsizing
Compute Optimizer
- Scaling and scheduling for cost
- EC2, Lambda and Fargate cost
Organizations
- Horizontal vs vertical scaling
Load Balancing
- Regions and AZs as the HA building block
- Picking compute by workload
- Instance families and sizing
Lambda
Fargate
Outposts
- Hybrid and edge compute options
NLB and GWLB
- Placing resources
- Cost allocation tags
Cost Explorer
Budgets
Cost and Usage Reports
- Multi-account billing
Auto Scaling