Cost optimization là một trong 6 pillars Well-Architected Framework.
Compute optimization:
- Chuyển On-Demand sang Reserved Instances/Savings Plans (tiết kiệm 30-60% cho baseline workload).
- Dùng Spot Instances cho batch/fault-tolerant workload (tiết kiệm đến 90%).
- Right-size instances (dùng Compute Optimizer để suggest instance type phù hợp).
- Tắt non-production environment ngoài giờ làm việc (Lambda + EventBridge scheduler).
Storage optimization:
- S3 Intelligent-Tiering cho data không rõ access pattern.
- Lifecycle policy chuyển sang IA/Glacier/Deep Archive.
- Enable S3 compression.
- Xóa unattached EBS volumes (thường quên tạo snapshot rồi delete instance).
- Xóa old EBS snapshots.
- Dùng gp3 thay gp2 (rẻ hơn 20% và IOPS cao hơn).
Data transfer optimization:
- Data transfer within region miễn phí.
- Cross-AZ $0.01/GB mỗi chiều (đặt DB và app cùng AZ cho non-HA workload).
- CloudFront giảm origin data transfer.
- VPC Endpoint loại bỏ NAT Gateway cost cho S3/DynamoDB access.
Database optimization: Aurora Serverless cho dev/test, DynamoDB on-demand cho sporadic traffic, ElastiCache giảm DB load và RDS cost.
Monitoring cost: AWS Cost Explorer phân tích spending trend, Budget Alerts khi vượt threshold, Cost Allocation Tags track by team/project, Trusted Advisor recommendations. Kiến trúc: serverless loại bỏ idle compute cost, managed services giảm operational labor cost.
Cost optimization is one of the 6 pillars of the Well-Architected Framework.
Compute optimization:
- Move from On-Demand to Reserved Instances/Savings Plans (30-60% savings for baseline workloads).
- Use Spot Instances for batch/fault-tolerant workloads (up to 90% savings).
- Right-size instances (use Compute Optimizer to suggest appropriate instance types).
- Shut down non-production environments outside business hours (Lambda + EventBridge scheduler).
Storage optimization:
- Use S3 Intelligent-Tiering for data with unknown access patterns.
- Lifecycle policies to transition to IA/Glacier/Deep Archive.
- Enable S3 compression.
- Delete unattached EBS volumes (often forgotten after taking a snapshot and deleting an instance).
- Delete old EBS snapshots.
- Switch from gp2 to gp3 (20% cheaper with higher IOPS).
Data transfer optimization:
- Data transfer within a region is free.
- Cross-AZ is $0.01/GB per direction (place DB and app in the same AZ for non-HA workloads).
- CloudFront reduces origin data transfer.
- VPC Endpoints eliminate NAT Gateway costs for S3/DynamoDB access.
Database optimization: use Aurora Serverless for dev/test, DynamoDB on-demand for sporadic traffic, and ElastiCache to reduce DB load and RDS costs.
Cost monitoring: use AWS Cost Explorer to analyze spending trends, Budget Alerts for threshold notifications, Cost Allocation Tags to track by team/project, and Trusted Advisor recommendations. Architecture: serverless eliminates idle compute costs, and managed services reduce operational labor costs.