Compute Resource Optimization - Rightsizing with AWS Compute Optimizer

Learn about resource rightsizing with AWS Compute Optimizer. Covers recommendations for EC2, Lambda, EBS, and ECS on Fargate, cost savings estimates, and implementation steps.

The Importance of Resource Rightsizing

Over-provisioning cloud resources is the most common cause of wasted costs. Cases such as using m5.xlarge in production while actual CPU utilization averages below 10%, allocating 1024 MB of memory to a Lambda function while actual usage is below 200 MB, or continuing to use gp2 volumes when switching to gp3 could reduce costs by 20% are extremely common. AWS Compute Optimizer is a service that analyzes CloudWatch metrics with ML models and recommends optimal settings for each resource. It analyzes usage patterns over the past 14 days (up to 93 days with enhanced metrics) and presents recommendations that optimize costs while maintaining performance. Rather than simple CPU utilization threshold checks, it comprehensively evaluates multiple metrics including CPU, memory, network, and disk I/O, resulting in highly accurate recommendations.

EC2 and Lambda Recommendations

EC2 instance recommendations present up to three recommended options for the current instance type. Each option includes the instance type, estimated monthly cost, and performance risk (Low/Medium/High). For example, if you are using m5.xlarge (4 vCPU / 16 GB) with low CPU utilization, downsizing to m5.large (2 vCPU / 8 GB) or migrating to m7g.large (Graviton3) may be recommended. Graviton migration recommendations are a distinctive feature of Compute Optimizer, presenting cost savings from ARM architecture migration in specific dollar amounts. Lambda function recommendations present optimal memory sizes. Since Lambda allocates CPU proportionally to memory, memory optimization affects both cost and performance. Excessive memory allocation directly wastes costs, while insufficient allocation extends execution time (= increased costs). ```bash # Enable Compute Optimizer aws compute-optimizer update-enrollment-status \ --status Active \ --region ap-northeast-1 # Get EC2 recommendations aws compute-optimizer get-ec2-instance-recommendations \ --region ap-northeast-1 \ --query 'instanceRecommendations[].{Id:instanceArn,Finding:finding,Current:currentInstanceType,Recommended:recommendationOptions[0].instanceType}' ```

EBS and ECS Recommendations

EBS volume recommendations present optimal values for volume type, size, IOPS, and throughput. The most common recommendation is migration from gp2 to gp3. gp3 is 20% lower cost at baseline compared to gp2, and IOPS and throughput can be configured independently, enabling optimization tailored to your workload. For Provisioned IOPS (io1/io2) volumes, IOPS value reduction may be recommended based on actual IOPS utilization. ECS on Fargate recommendations present optimal CPU and memory values for task definitions. Fargate tasks are billed based on CPU (0.25 to 4 vCPU) and memory (0.5 to 30 GB) combinations, so rightsizing directly impacts costs. Compute Optimizer analyzes actual resource utilization for each task and recommends settings that minimize costs while maintaining performance. For understanding cloud optimization analysis methods, related books (Amazon) can be a useful reference.

Implementation and Organizations Integration

Compute Optimizer is enabled on a per-account basis, and recommendation generation begins within 12 hours of activation. Basic features are free, using CloudWatch standard metrics (5-minute intervals) to analyze the past 14 days of data. Enhanced Infrastructure Metrics is a paid option that provides memory utilization analysis and up to 93 days of analysis period. Memory utilization requires CloudWatch agent installation, but considering both CPU and memory for EC2 rightsizing significantly improves recommendation accuracy. Organizations integration enables bulk activation of Compute Optimizer across all accounts in the organization from the management account and aggregation of recommendations. Recommendations can be exported to S3, and organization-wide cost optimization reports can be created with Athena or QuickSight.

Compute Optimizer Pricing

Compute Optimizer's basic features are free to use, including recommendations for EC2, Auto Scaling groups, EBS volumes, and Lambda functions. Enhanced recommendations (3-month metric analysis) cost approximately $0.0003344 per enabled resource per month. Rightsizing instances based on recommendations can reduce over-provisioning costs by 20-40% in many cases, and the Optimizer's cost is immediately recouped.

Summary - Compute Optimizer Usage Guidelines

AWS Compute Optimizer is a service that recommends rightsizing for EC2, Lambda, EBS, and ECS on Fargate through ML-based analysis. Basic features are free, and recommendations are automatically generated simply by enabling the service. It delivers results on both fronts: cost reduction through detecting over-provisioning and performance improvement through detecting under-provisioning. Combined with Trusted Advisor's cost optimization checks, you can comprehensively cover resource-level optimization (Compute Optimizer) and account-level optimization (Trusted Advisor). We recommend enabling it across all AWS accounts.