Study guide
Cost optimization accounts for about 20% of the exam and tests whether you can meet a requirement at the lowest sustainable price, since the cheapest architecture and the most resilient or highest-performing one are often in tension. This chapter reviews the pricing models and tools AWS provides to right-size spending across compute, storage, and databases without silently sacrificing the requirements set elsewhere in a scenario.
EC2 Pricing Options: Matching Commitment to Workload Pattern
On-Demand pricing charges by the second or hour with no upfront commitment, making it the most flexible but most expensive option per unit of compute, best suited to unpredictable or short-term workloads such as a proof of concept or a workload that cannot tolerate interruption and lacks a steady enough pattern to commit to. Reserved Instances (RIs) commit to a specific instance family and Region (or Availability Zone, for a zonal reservation) for a one-year or three-year term in exchange for a substantial discount versus On-Demand, and can be purchased with no upfront, partial upfront, or all upfront payment, with more upfront payment yielding a deeper discount. Savings Plans offer similar discount depths to RIs but with more flexibility: a Compute Savings Plan commits to a dollar amount of compute usage per hour and automatically applies across instance families, sizes, Regions, and even to Fargate and Lambda usage, while an EC2 Instance Savings Plan commits to a specific instance family within a Region in exchange for a somewhat deeper discount than the Compute option. Spot Instances let you use spare EC2 capacity at discounts that can reach a large percentage off On-Demand pricing, but AWS can reclaim a Spot Instance with a two-minute warning whenever it needs the capacity back, so Spot suits fault-tolerant, flexible workloads like batch processing, big data analysis, or CI/CD build fleets, never a stateful workload that cannot handle sudden termination. A scenario describing a steady-state production database running continuously for years points to a Reserved Instance or Savings Plan; a scenario describing an interruptible nightly video rendering batch job at a company like Castellan Media points to Spot.
S3 Lifecycle Policies and Storage Class Analysis
Not all stored data needs the same performance tier forever, and S3 Lifecycle policies automate the process of moving objects to cheaper storage classes, or deleting them, as they age. A typical lifecycle rule might transition objects from S3 Standard to S3 Standard-Infrequent Access after 30 days once access frequency drops, then to S3 Glacier Flexible Retrieval after 90 days for long-term archival, and finally expire the objects entirely after seven years to satisfy a data retention policy while avoiding indefinite storage cost. S3 Standard-IA and S3 One Zone-IA cost less per gigabyte stored than S3 Standard but charge a retrieval fee, so they suit data accessed infrequently, perhaps once a month, rather than data accessed constantly; One Zone-IA further reduces cost by storing data in a single AZ, appropriate only when the data can be recreated or is not critical enough to need multi-AZ redundancy. S3 Intelligent-Tiering removes the guesswork by automatically moving objects between access tiers based on observed usage patterns for a small monitoring fee, which suits data with unknown or changing access patterns, such as a shared document repository at a firm like Halloway Consulting where usage of any given file is unpredictable. S3 Storage Class Analysis observes actual access patterns over time and produces recommendations for which objects are good candidates to move to Standard-IA, taking the guesswork out of writing lifecycle rules manually. A scenario describing predictable, known access patterns, like log files that are hot for 30 days and then rarely touched, favors a manually defined lifecycle policy for a lower ongoing cost; a scenario describing unpredictable access favors Intelligent-Tiering despite its small monitoring fee.
Right-Sizing and Visibility: Compute Optimizer, Cost Explorer, and Trusted Advisor
AWS Compute Optimizer analyzes historical utilization metrics for EC2 instances, EBS volumes, Lambda functions, and Auto Scaling Groups, then recommends more cost-effective configurations, such as downsizing an oversized instance that has run at 8% average CPU utilization for weeks, or flagging a workload that would perform equally well and more cheaply on a different instance family entirely. This directly targets waste from over-provisioning, a common real-world cost problem where resources were sized generously at launch and never revisited. AWS Cost Explorer visualizes historical spending and usage patterns with filtering by service, account, tag, and time period, and includes forecasting to project future costs based on historical trends. AWS Budgets lets you set custom cost or usage thresholds and receive alerts, or even trigger automated actions, when actual or forecasted spending approaches or exceeds those thresholds, which suits a scenario where a finance team at a company like Merriden Holdings wants an automatic notification before a development team's monthly cloud spend crosses an agreed limit. AWS Cost Anomaly Detection uses machine learning to learn normal spending patterns per service or account and alerts on unexpected deviations, catching problems like a misconfigured resource silently accumulating charges, faster than a human reviewing monthly invoices would. AWS Trusted Advisor inspects an account across several categories, including a cost optimization category that flags idle load balancers, underutilized EC2 instances, and unattached EBS volumes still being billed, alongside its security, performance, fault tolerance, and service limit checks. Together, these tools form a review cycle: Compute Optimizer and Trusted Advisor surface specific resource-level waste, while Cost Explorer, Budgets, and Anomaly Detection provide the broader visibility and alerting to keep spending predictable over time.
Serverless Cost Trade-offs and Data Transfer Minimization
Serverless and provisioned resources sit at opposite ends of a cost trade-off curve. A provisioned resource, such as an always-on EC2 instance or a fixed-capacity RDS database, costs money whether or not it is actively serving requests, but at high, steady utilization its per-unit cost is typically lower than the equivalent serverless option. A serverless resource, such as AWS Lambda or DynamoDB in on-demand mode, charges only for actual usage with no idle cost, which is far cheaper for spiky, intermittent, or unpredictable workloads but can become more expensive than a provisioned equivalent once utilization is consistently high, because you are paying a premium for the elasticity and lack of management overhead. Aurora Serverless v2 for relational workloads and DynamoDB on-demand capacity mode for NoSQL workloads both apply this logic: they scale automatically and remove the need to forecast traffic, suiting a workload like a seasonal event-registration site at a company like Pinnacle Fairgrounds that sees almost no traffic most of the year and a massive spike during a signup window, since provisioning fixed capacity for that spike year-round would waste money the rest of the time. For steady, predictable, high-volume workloads, provisioned capacity with auto scaling and Reserved Instance or Savings Plan pricing usually wins on raw cost. Data transfer charges are a frequently overlooked cost lever: transferring data between Regions, or out to the internet, incurs charges, while transfer within the same Availability Zone is typically free and transfer between AZs in the same Region costs less than cross-Region transfer. Architectures that keep tightly coupled components in the same AZ, use VPC endpoints to avoid routing AWS service traffic through a NAT gateway, and use CloudFront to reduce repeated origin data transfer all shrink this often-underestimated line item on the bill.
Key terms
- Reserved Instance (RI)
- — A one- or three-year EC2 commitment to a specific instance family and Region (or AZ) in exchange for a discount versus On-Demand pricing.
- Savings Plan
- — A flexible pricing commitment to a dollar amount of compute usage per hour, applicable across instance families or, for Compute Savings Plans, across EC2, Fargate, and Lambda.
- Spot Instance
- — Spare EC2 capacity offered at a steep discount versus On-Demand, reclaimable by AWS with a two-minute warning; suited only to fault-tolerant, interruptible workloads.
- S3 Lifecycle policy
- — An automated rule that transitions S3 objects to cheaper storage classes or expires them after defined time periods.
- S3 Intelligent-Tiering
- — An S3 storage class that automatically moves objects between access tiers based on observed usage, for unpredictable access patterns.
- AWS Compute Optimizer
- — A service that analyzes historical resource utilization and recommends more cost-effective EC2, EBS, Lambda, or ASG configurations.
- AWS Cost Anomaly Detection
- — A machine-learning-based service that learns normal spending patterns and alerts on unexpected cost deviations.
- AWS Trusted Advisor
- — A tool that inspects an account for cost, security, performance, fault tolerance, and service limit issues, flagging items like idle or underutilized resources.
- Aurora Serverless v2
- — An Aurora configuration that automatically scales database compute capacity in fine-grained increments based on load, billed for actual usage.
- DynamoDB on-demand capacity mode
- — A DynamoDB billing mode that charges per request with no capacity planning, suited to unpredictable traffic.
- Data transfer cost
- — Charges incurred for moving data across AZs, Regions, or out to the internet; same-AZ transfer is typically free.
- S3 Storage Class Analysis
- — An S3 feature that observes access patterns over time and recommends objects suitable for transition to Standard-IA.
Exam tips
- Match EC2 pricing model to workload predictability and interruptibility: steady-state favors Reserved Instances or Savings Plans, spiky/flexible favors On-Demand, fault-tolerant/interruptible favors Spot.
- When access patterns are known and predictable, a manual S3 Lifecycle policy is usually cheaper than Intelligent-Tiering; when access patterns are unknown or changing, Intelligent-Tiering avoids costly guesswork.
- Trusted Advisor and Compute Optimizer both surface waste, but Trusted Advisor gives broader account-health checks while Compute Optimizer gives deeper, metrics-based right-sizing recommendations.
- Serverless options (Lambda, Aurora Serverless v2, DynamoDB on-demand) usually win on cost for spiky or unpredictable workloads; provisioned options usually win at sustained high utilization.
- Watch for data transfer cost details in scenarios — keeping chatty resources in the same AZ, using VPC endpoints, and caching with CloudFront are frequently the intended cost-saving lever.