Cost-Optimized Architecture Design · Topic 2 of 8
Cost Optimized Compute and Rightsizing
Design lower cost compute with Graviton, Lambda and Step Functions Standard or Express, then rightsize with Compute Optimizer, scaling and Fargate Spot.
- 5 min
- Standard Workflows bill per state transition and run up to a year, while Express bills per request and duration and runs up to five minutes.
- Graviton gives better price performance, but the software stack must support arm64.
- Compute Optimizer uses 14 days of metrics by default, and up to 93 days with enhanced infrastructure metrics.
What it is
Purchase options lower the price of each unit of compute. Architecture and rightsizing lower the number of units you pay for.
This page covers both halves: picking a compute model that fits the workload shape, then using metrics to shrink and scale it so nothing runs idle.
How it works
Choosing the compute model
| Pattern | Lowest cost fit | Why |
|---|---|---|
| Steady, high utilization | EC2 or Fargate with Savings Plans | Idle time is low, so per hour pricing wins |
| Spiky or intermittent | Lambda or scale to zero containers | You pay only while code runs |
| Long running orchestration with waits | Step Functions Standard Workflows | Billed per state transition, waiting is free |
| High volume, short event processing | Step Functions Express Workflows | Billed per request and duration, cheap at high volume |
| Interruptible batch or CI | EC2 Spot or Fargate Spot | Spare capacity at a discount |
The trade-off is utilization. A function that runs constantly at high concurrency can cost more on Lambda than on a well utilized container or instance. A workload that sits idle most of the day almost always costs less on Lambda.
Graviton
AWS Graviton processors are Arm based and offer better price performance than comparable x86 instances for many workloads. They are available for EC2, Lambda (arm64 architecture), Fargate, and managed services such as RDS, Aurora and ElastiCache.
Managed services and interpreted languages usually move with little effort. Compiled code, native libraries and container images must be built for arm64, so the cost saving depends on whether the software stack supports Arm. Multi architecture container images let a cluster run both during a migration.
Step Functions Standard versus Express
| Feature | Standard | Express |
|---|---|---|
| Maximum duration | Up to one year | Up to five minutes |
| Pricing | Per state transition | Per request and by duration and memory |
| Execution semantics | Exactly once | At least once (asynchronous), at most once (synchronous) |
| Best fit | Long, auditable business processes, human approval | High volume event processing, streaming, IoT ingestion |
A workflow that runs millions of short executions a day is far cheaper as Express. A workflow that waits days for an approval must be Standard, and the wait itself costs nothing because no transitions occur.
Rightsizing with AWS Compute Optimizer
Compute Optimizer analyzes CloudWatch utilization metrics and recommends better sizes or types. It covers EC2 instances, Auto Scaling groups, EBS volumes, Lambda functions, ECS services on Fargate and RDS DB instances, and it flags idle resources.
By default it looks back 14 days. The paid enhanced infrastructure metrics feature extends the lookback to up to 93 days for EC2, Auto Scaling groups and RDS, which captures monthly cycles. Memory is not visible to EC2 by default, so install the CloudWatch agent to get memory aware recommendations.
Enable it at the organization level, from the management account or a delegated administrator, for one view across all member accounts.
Scaling strategies
| Policy | How it works | Use when |
|---|---|---|
| Target tracking | Keeps a metric near a target, such as 50% CPU | Default choice for most variable load |
| Step scaling | Adds or removes set amounts at alarm thresholds | Need different responses at different breach sizes |
| Scheduled scaling | Changes capacity at set times | Known business hours or batch windows |
| Predictive scaling | Forecasts load from history and scales ahead | Regular daily or weekly cycles with slow boot times |
Scheduled scaling is the simplest saving for non production. Scale development fleets to zero at night and at weekends, and scale production minimum capacity down outside business hours.
Fargate Spot
Fargate Spot runs interruption tolerant Amazon ECS tasks at a discount on spare capacity. When AWS needs the capacity back, the task gets a two minute warning as a SIGTERM signal and an EventBridge task state change event.
Use a capacity provider strategy that mixes Fargate and Fargate Spot. A base count on regular Fargate keeps a minimum running, and the weight sends extra tasks to Fargate Spot. Fargate does not fall back to regular Fargate when Spot capacity is short, so the base protects availability.
How the exam asks about this
- "Thousands of short IoT events per second each need a small multi step workflow, and cost must be minimized." -> Step Functions Express Workflows.
- "A fleet of EC2 instances runs at 10% CPU, and the team wants recommendations based on three months of data." -> Compute Optimizer with enhanced infrastructure metrics activated.
- "An ECS service must keep two tasks running but can run extra tasks on discounted capacity." -> A capacity provider strategy with a base on Fargate and additional weight on Fargate Spot.
What to remember for the exam
- Standard Workflows bill per state transition and run up to a year, while Express bills per request and duration and runs up to five minutes.
- Graviton gives better price performance, but the software stack must support arm64.
- Compute Optimizer uses 14 days of metrics by default, and up to 93 days with enhanced infrastructure metrics.
- Install the CloudWatch agent so Compute Optimizer can use memory metrics.
- Target tracking is the default scaling policy, scheduled scaling fits known hours, and predictive scaling fits regular cycles.
- Fargate Spot gives a two minute warning and does not fall back to regular Fargate on its own.
Rightsize before you commit. Buying a Savings Plan for an oversized fleet locks in the waste for one or three years.
Common mistakes
Moving everything to Lambda to save money. Constant, high utilization work can cost more on Lambda. The saving comes from idle time, so check the usage pattern first.
Choosing Express for long approval flows. Express executions stop at five minutes. Anything that waits for a person or an external system for hours needs Standard.
Trusting CPU only recommendations. Without the CloudWatch agent, memory pressure is invisible and a downsized instance may start swapping. Collect memory metrics before acting on aggressive downsizing.
Check yourself
Which Step Functions workflow type is cheaper for millions of executions that each finish in seconds?
Express Workflows, because they are billed per request and duration rather than per state transition.
How can Compute Optimizer base EC2 recommendations on about three months of data?
Activate the paid enhanced infrastructure metrics preference, which extends the lookback from 14 days to up to 93 days.
What happens to a Fargate Spot task when AWS reclaims capacity?
It receives a two minute warning as a SIGTERM and an EventBridge event, then it is stopped.
Topic 2 of 8 in Cost-Optimized Architecture Design
Test yourself on Cost-Optimized Architecture Design
The full AWS SAP-C03 question bank has 850 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.