Xoxoftware - XOXO Creative Studio | Web & Mobile App Development | Fred Cheung | Hong Kong
Concepts

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

ModelCommitmentDiscount vs On-DemandBest For
On-DemandNone0%Unpredictable workloads, short-term, dev/test
Savings Plans (Compute)1 or 3 yrUp to 66%Flexible across EC2, Fargate, Lambda
Savings Plans (EC2 Instance)1 or 3 yrUp to 72%Locked to instance family + region
Reserved Instances1 or 3 yrUp to 72%Steady-state, predictable workloads
Spot InstancesNoneUp to 90%Fault-tolerant, flexible, interruptible
Dedicated HostsOn-Demand or ReservedVariesLicensing (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 continuously

Tools for Right-Sizing

ToolDescription
AWS Compute OptimizerML-based recommendations for EC2, EBS, Lambda, ECS on Fargate
AWS Cost Explorer (right-sizing)RI and instance right-sizing recommendations
Trusted AdvisorChecks for idle and underutilised resources
CloudWatch AgentMemory and disk metrics (not available by default on EC2)

Storage Cost Optimization

StrategyImplementation
S3 Lifecycle policiesTransition objects: Standard → IA → Glacier → Deep Archive
S3 Intelligent-TieringAutomatic tier movement based on access patterns (no retrieval fee)
EBS volume type selectiongp3 over gp2 (cheaper baseline IOPS); delete unattached volumes
EBS SnapshotsDelete old snapshots; use EBS Snapshot Archive for rarely accessed
S3 Storage LensVisibility into bucket-level usage patterns and anomalies

Database Cost Optimization

StrategyImplementation
Aurora Serverless v2Scales to zero ACU; pay only during active queries
RDS Reserved Instances1-yr or 3-yr commitment for steady-state databases
DynamoDB On-Demand modePay-per-request for unpredictable traffic; switch to Provisioned for steady
ElastiCache Reserved NodesCommit for predictable caching workloads
Read ReplicasOffload reads to cheaper read replicas instead of scaling primary

Network Cost Optimization

StrategyImplementation
Same-AZ deploymentAvoid cross-AZ data transfer charges where HA is not critical
VPC Endpoints (Gateway)Free S3/DynamoDB access without NAT Gateway data charges
CloudFrontCache at edge to reduce origin data transfer
NAT Gateway alternativesNAT Instance for low-traffic; VPC endpoints where possible
S3 Transfer AccelerationOnly enable when cross-region speed improvement justifies cost

AWS Cost Management Tools

ToolPurpose
AWS Cost ExplorerVisualise, filter, and forecast spend; RI/SP recommendations
AWS BudgetsSet cost, usage, and reservation budgets with alerts
Cost Allocation TagsTag resources to attribute costs to teams, projects, or environments
AWS Cost and Usage ReportDetailed hourly/daily CSV report delivered to S3 for analysis
Savings Plans / RI recommendationsAutomated analysis of usage patterns for commitment purchases
AWS Compute OptimizerRight-sizing recommendations using ML on utilization data
Trusted AdvisorCost optimization checks (idle RDS, underused EC2, etc.)

Quick Reference

Optimization AreaQuick WinTool / Service
ComputeRight-size or terminate idle instancesCompute Optimizer
ComputePurchase Savings Plans for steady-state workloadsCost Explorer
ComputeUse Spot for fault-tolerant batch processingEC2 Spot / Spot Fleet
StorageEnable S3 Lifecycle policies to tier down cold dataS3 Management
StorageDelete unattached EBS volumes and old snapshotsTrusted Advisor
DatabaseUse Reserved Instances for production RDS/ElastiCacheCost Explorer
DatabaseSwitch DynamoDB to On-Demand for sporadic workloadsDynamoDB Console
NetworkingUse VPC Gateway Endpoints for S3/DynamoDBVPC Configuration
VisibilitySet up AWS Budgets with SNS alertsAWS Budgets

AWS Implementation Options

Cost StrategyAWS Service / Feature
Commitment-based discountsSavings Plans, Reserved Instances
Interruptible compute discountsEC2 Spot Instances, Spot Fleet
Auto-scale to demandAuto Scaling Groups, Aurora Serverless, DynamoDB On-Demand
Storage tieringS3 Lifecycle, S3 Intelligent-Tiering, EBS Snapshot Archive
Spending alertsAWS Budgets, CloudWatch billing alarms
Usage analysisCost Explorer, Cost and Usage Report, Cost Allocation Tags
Right-sizingCompute 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.


Built by Fred Cheung @CookedRicer · Powered by Fumadocs & Github Copilot

On this page