Cost Optimization
AWS cost management — strategies for right-sizing, pricing models, reserved capacity, and tooling to reduce cloud spend without sacrificing performance.
Overview
Cost optimization is the practice of reducing AWS spend while maintaining required performance and availability — it covers pricing model selection, right-sizing resources, storage tiering, and using AWS cost management tools to gain visibility and control.
Pricing Models
| Model | Commitment | Discount vs On-Demand | Best For |
|---|---|---|---|
| On-Demand | None | 0% | Unpredictable workloads, short-term, dev/test |
| Savings Plans (Compute) | 1 or 3 yr | Up to 66% | Flexible across EC2, Fargate, Lambda |
| Savings Plans (EC2 Instance) | 1 or 3 yr | Up to 72% | Locked to instance family + region |
| Reserved Instances | 1 or 3 yr | Up to 72% | Steady-state, predictable workloads |
| Spot Instances | None | Up to 90% | Fault-tolerant, flexible, interruptible |
| Dedicated Hosts | On-Demand or Reserved | Varies | Licensing (BYOL), compliance requirements |
Right-Sizing
Right-sizing means matching instance types and sizes to actual workload requirements — it is the most impactful cost optimization lever for compute.
Process
1. Collect metrics (CloudWatch: CPU, Memory, Network, Disk)
2. Identify underutilised instances (< 40% average CPU)
3. Recommend smaller instance type or family change
4. Implement change (resize, migrate, or terminate)
5. Monitor and repeat continuouslyTools for Right-Sizing
| Tool | Description |
|---|---|
| AWS Compute Optimizer | ML-based recommendations for EC2, EBS, Lambda, ECS on Fargate |
| AWS Cost Explorer (right-sizing) | RI and instance right-sizing recommendations |
| Trusted Advisor | Checks for idle and underutilised resources |
| CloudWatch Agent | Memory and disk metrics (not available by default on EC2) |
Storage Cost Optimization
| Strategy | Implementation |
|---|---|
| S3 Lifecycle policies | Transition objects: Standard → IA → Glacier → Deep Archive |
| S3 Intelligent-Tiering | Automatic tier movement based on access patterns (no retrieval fee) |
| EBS volume type selection | gp3 over gp2 (cheaper baseline IOPS); delete unattached volumes |
| EBS Snapshots | Delete old snapshots; use EBS Snapshot Archive for rarely accessed |
| S3 Storage Lens | Visibility into bucket-level usage patterns and anomalies |
Database Cost Optimization
| Strategy | Implementation |
|---|---|
| Aurora Serverless v2 | Scales to zero ACU; pay only during active queries |
| RDS Reserved Instances | 1-yr or 3-yr commitment for steady-state databases |
| DynamoDB On-Demand mode | Pay-per-request for unpredictable traffic; switch to Provisioned for steady |
| ElastiCache Reserved Nodes | Commit for predictable caching workloads |
| Read Replicas | Offload reads to cheaper read replicas instead of scaling primary |
Network Cost Optimization
| Strategy | Implementation |
|---|---|
| Same-AZ deployment | Avoid cross-AZ data transfer charges where HA is not critical |
| VPC Endpoints (Gateway) | Free S3/DynamoDB access without NAT Gateway data charges |
| CloudFront | Cache at edge to reduce origin data transfer |
| NAT Gateway alternatives | NAT Instance for low-traffic; VPC endpoints where possible |
| S3 Transfer Acceleration | Only enable when cross-region speed improvement justifies cost |
AWS Cost Management Tools
| Tool | Purpose |
|---|---|
| AWS Cost Explorer | Visualise, filter, and forecast spend; RI/SP recommendations |
| AWS Budgets | Set cost, usage, and reservation budgets with alerts |
| Cost Allocation Tags | Tag resources to attribute costs to teams, projects, or environments |
| AWS Cost and Usage Report | Detailed hourly/daily CSV report delivered to S3 for analysis |
| Savings Plans / RI recommendations | Automated analysis of usage patterns for commitment purchases |
| AWS Compute Optimizer | Right-sizing recommendations using ML on utilization data |
| Trusted Advisor | Cost optimization checks (idle RDS, underused EC2, etc.) |
Quick Reference
| Optimization Area | Quick Win | Tool / Service |
|---|---|---|
| Compute | Right-size or terminate idle instances | Compute Optimizer |
| Compute | Purchase Savings Plans for steady-state workloads | Cost Explorer |
| Compute | Use Spot for fault-tolerant batch processing | EC2 Spot / Spot Fleet |
| Storage | Enable S3 Lifecycle policies to tier down cold data | S3 Management |
| Storage | Delete unattached EBS volumes and old snapshots | Trusted Advisor |
| Database | Use Reserved Instances for production RDS/ElastiCache | Cost Explorer |
| Database | Switch DynamoDB to On-Demand for sporadic workloads | DynamoDB Console |
| Networking | Use VPC Gateway Endpoints for S3/DynamoDB | VPC Configuration |
| Visibility | Set up AWS Budgets with SNS alerts | AWS Budgets |
AWS Implementation Options
| Cost Strategy | AWS Service / Feature |
|---|---|
| Commitment-based discounts | Savings Plans, Reserved Instances |
| Interruptible compute discounts | EC2 Spot Instances, Spot Fleet |
| Auto-scale to demand | Auto Scaling Groups, Aurora Serverless, DynamoDB On-Demand |
| Storage tiering | S3 Lifecycle, S3 Intelligent-Tiering, EBS Snapshot Archive |
| Spending alerts | AWS Budgets, CloudWatch billing alarms |
| Usage analysis | Cost Explorer, Cost and Usage Report, Cost Allocation Tags |
| Right-sizing | Compute Optimizer, Trusted Advisor |
SAA/SAP Exam Tips
SAA Tip: "Reduce cost for steady-state workloads" → Savings Plans or Reserved Instances. "Reduce cost for fault-tolerant, flexible workloads" → Spot Instances.
SAP Tip: Compute Savings Plans are more flexible than EC2 Instance Savings Plans — they apply across EC2, Fargate, and Lambda. EC2 Instance Savings Plans offer a deeper discount but are locked to a specific instance family and region.
SAA Tip: "Reduce data transfer costs to S3/DynamoDB" → Use VPC Gateway Endpoints (free). NAT Gateway charges per GB of data processed, making it expensive for high-volume S3 traffic.
Related Services / See Also
- Amazon EC2 — purchasing options (On-Demand, RI, Spot, Savings Plans)
- Amazon S3 — storage classes and lifecycle policies
- Auto Scaling — scale compute to match demand dynamically
- Well-Architected Framework — Cost Optimization pillar
AWS Storage Gateway
AWS Storage Gateway — hybrid cloud storage service bridging on-premises environments with AWS cloud storage. Covers gateway types (S3 File, FSx File, Volume, Tape), use cases, and cross-cloud equivalents.
Database Performance Fundamentals
Core database performance concepts: WAL, CPU vs RAM trade-offs, IOPS, Throughput, OLTP vs OLAP. Essential background for AWS database service selection on SAA/SAP exams.