---
name: "aws-cost-optimization"
displayName: "AWS Cost Optimization"
description: "AWS cost optimization tools for business teams and developers. Analyze spending, get optimization recommendations, and build cost-aware applications with AWS Well-Architected best practices."
keywords: ["finops", "cost-optimization", "aws-billing", "cost-analysis", "budget-management", "rightsizing", "cost-intelligence", "savings-plans", "reserved-instances", "cost-anomaly", "spend-analysis", "cost-forecasting", "resource-optimization", "well-architected", "cloud-financial-management", "consumption-model", "efficiency-measurement", "expenditure-analysis", "developer-cost-optimization", "pre-deployment-analysis", "architecture-cost-modeling", "development-environment-optimization", "cost-aware-development"]
author: "Venkat Pullela"
license: "Apache-2.0"
---
AWS cost optimization tools for business teams and developers. Analyze spending, get optimization recommendations, and build cost-aware applications with AWS Well-Architected best practices.
Kiro Powers extend your AI development environment with specialized capabilities for specific domains and workflows. This AWS Cost Optimization Power brings together multiple AWS cost management services into a unified, intelligent interface that helps you understand, optimize, and control your cloud spending.
Whether you're a FinOps professional managing organizational budgets, a developer building cost-aware applications, or an architect designing efficient infrastructure, this power provides the tools and guidance you need. Instead of switching between multiple AWS consoles and learning different APIs, you can use natural language to query costs, analyze spending patterns, get optimization recommendations, and model infrastructure costs - all within your development workflow.
The power integrates three AWS Labs MCP servers to provide:
Built around the AWS Well-Architected Cost Optimization Pillar's five design principles, this power helps you implement cloud financial management, adopt consumption models, measure efficiency, leverage managed services, and analyze expenditure attribution - turning cost optimization from a reactive process into a proactive development practice.
Example: "Show me our organizational cost breakdown by business unit"
Example: "Compare our costs between last quarter and this quarter"
Example: "Find cost optimization opportunities across our organization"
Example: "Provide cost estimates for this CDK stack before I deploy it"
Example: "Analyze costs for our development environments"
Example: "Compare Lambda vs ECS costs for my microservice architecture"
---
For Business & FinOps Teams - Try these organizational cost management commands:
"Show me our AWS costs for the last 3 months by business unit"
"What are our top 5 cost drivers this month?"
"Find cost optimization opportunities across our organization"
"Show me our current budgets and their performance"
"Analyze our Reserved Instance utilization and savings"
"Compare our costs between last quarter and this quarter"
"Detect any cost anomalies in the last 30 days"
For Developers & Engineering Teams - Try these development-focused commands:
"Provide cost estimates for this CDK stack before deployment"
"Compare Lambda vs ECS costs for my microservice"
"What's the cheapest way to build this serverless API?"
"Show me pricing differences between us-east-1 and eu-west-1"
"Analyze costs for our development environments"
"Monitor our Free Tier usage to avoid unexpected charges"
"Show me CPU utilization for rightsizing my EC2 instances"
"Analyze Lambda execution patterns affecting costs"
"Find cost-related CloudWatch alarms that are firing"
"Create cost efficiency metrics for my resources"
New to AWS Cost Management? Follow the onboarding section below for setup guidance.
Need help choosing the right tool? Use our tool selection guide:
Call action "readSteering" with powerName="aws-cost-optimization", steeringFile="tool-selection-guide.md"
---
Package: awslabs.billing-cost-management-mcp-server
License: Apache-2.0
Purpose: Cost analysis, budget monitoring (read-only), and optimization recommendations
Documentation: https://awslabs.github.io/mcp/servers/billing-cost-management-mcp-server/
Package: awslabs.aws-pricing-mcp-server
License: Apache-2.0
Purpose: Real-time pricing intelligence, cost modeling, and infrastructure cost analysis
Documentation: https://awslabs.github.io/mcp/servers/aws-pricing-mcp-server/
Package: awslabs.cloudwatch-mcp-server
License: Apache-2.0
Purpose: Metrics monitoring, log analysis, dashboard management, and operational insights for cost optimization
Documentation: https://awslabs.github.io/mcp/servers/cloudwatch-mcp-server/
---
The AWS Cost Optimization Power provides these tools across two MCP servers:
---
Before using the AWS Cost Optimizer Power, ensure you have:
1. AWS CLI (version 2.32.0 or later recommended)
2. UV (Python package manager)
You must ensure that there are valid AWS credentials. This is required for all cost management tools to function properly.
Configure credentials using one of these methods:
aws configure
Enter your Access Key ID, Secret Access Key, default region, and output format.
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1
aws configure sso
Verify credentials:
AWS_PAGER="" aws sts get-caller-identity
Important for MCP Servers: The MCP servers in this power use AWS credential files (~/.aws/credentials) rather than environment variables. If you're using temporary credentials (like AWS SSO or session tokens), ensure they are saved to the credential file, not just set as environment variables.
Cost Explorer is enabled by default for most AWS accounts, but verify:
1. Go to AWS Billing Console → Cost Explorer
2. If prompted, click "Enable Cost Explorer"
3. Wait 24 hours for initial data population
Ensure your AWS user/role has the required permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ce:*",
"budgets:*",
"pricing:*",
"organizations:ListAccounts",
"organizations:DescribeOrganization",
"support:*",
"cur:*",
"cloudwatch:*",
"logs:*"
],
"Resource": "*"
}
]
}
Once credentials are configured, you can immediately start using the power:
---
Get monthly costs by service:
usePower("aws-cost-optimization", "aws-billing-cost-management", "cost_explorer", {
"operation": "getCostAndUsage",
"start_date": "2024-11-01",
"end_date": "2024-12-01",
"granularity": "MONTHLY",
"group_by": "[{\"Type\": \"DIMENSION\", \"Key\": \"SERVICE\"}]",
"metrics": "[\"UnblendedCost\"]"
})
// Returns: Cost breakdown by AWS service
Get cost forecast for next 3 months:
usePower("aws-cost-optimization", "aws-billing-cost-management", "cost_explorer", {
"operation": "getCostForecast",
"metric": "UNBLENDED_COST",
"granularity": "MONTHLY",
"start_date": "2024-12-22",
"end_date": "2025-03-22"
})
// Returns: Cost forecast with confidence intervals
Compare costs month-over-month:
usePower("aws-cost-optimization", "aws-billing-cost-management", "cost_comparison", {
"operation": "getCostAndUsageComparisons",
"baseline_start_date": "2024-10-01",
"baseline_end_date": "2024-11-01",
"comparison_start_date": "2024-11-01",
"comparison_end_date": "2024-12-01",
"metric_for_comparison": "UnblendedCost"
})
// Returns: Cost changes and percentage differences
Get cost optimization opportunities:
usePower("aws-cost-optimization", "aws-billing-cost-management", "cost_optimization", {
"operation": "list_recommendations",
"filters": "{\"actionTypes\": [\"Rightsize\", \"Stop\", \"Delete\"]}"
})
// Returns: Actionable cost optimization recommendations with estimated savings
Get detailed recommendation analysis:
usePower("aws-cost-optimization", "aws-billing-cost-management", "rec_details", {
"recommendation_id": "arn:aws:cost-optimization-hub:us-east-1:123456789012:recommendation/12345"
})
// Returns: Detailed analysis combining multiple AWS services data
Get EC2 rightsizing recommendations:
usePower("aws-cost-optimization", "aws-billing-cost-management", "compute_optimizer", {
"operation": "get_ec2_instance_recommendations"
})
// Returns: Performance-based EC2 rightsizing opportunities
Monitor existing budgets (read-only):
usePower("aws-cost-optimization", "aws-billing-cost-management", "budgets", {
"max_results": 100
})
// Returns: List of existing budgets with current spend vs limits (read-only - cannot create or modify budgets)
Detect cost anomalies:
usePower("aws-cost-optimization", "aws-billing-cost-management", "cost_anomaly", {
"start_date": "2024-11-01",
"end_date": "2024-12-01",
"total_impact_start": 100
})
// Returns: Cost anomalies above $100 with impact analysis
Monitor Free Tier usage:
usePower("aws-cost-optimization", "aws-billing-cost-management", "free_tier_usage", {
"operation": "get_free_tier_usage"
})
// Returns: Free Tier usage across services with limits
Analyze Reserved Instance utilization:
usePower("aws-cost-optimization", "aws-billing-cost-management", "ri_performance", {
"operation": "get_reservation_utilization",
"start_date": "2024-11-01",
"end_date": "2024-12-01",
"granularity": "MONTHLY"
})
// Returns: RI utilization metrics and efficiency analysis
Analyze Savings Plans performance:
usePower("aws-cost-optimization", "aws-billing-cost-management", "sp_performance", {
"operation": "get_savings_plans_utilization",
"start_date": "2024-11-01",
"end_date": "2024-12-01"
})
// Returns: Savings Plans utilization and coverage metrics
Compare EC2 pricing across regions:
usePower("aws-cost-optimization", "aws-pricing", "get_pricing", {
"service_code": "AmazonEC2",
"region": ["us-east-1", "us-west-2", "eu-west-1"],
"filters": [
{"Field": "instanceType", "Value": "m5.large", "Type": "EQUALS"}
]
})
// Returns: Regional pricing comparison for specific instance type
Discover available services:
usePower("aws-cost-optimization", "aws-pricing", "get_pricing_service_codes", {
"filter": "bedrock"
})
// Returns: AWS services matching "bedrock" pattern
Analyze CDK project costs:
usePower("aws-cost-optimization", "aws-pricing", "analyze_cdk_project", {
"project_path": "./my-cdk-app"
})
// Returns: AWS services used in CDK project with cost implications
Generate detailed cost report:
usePower("aws-cost-optimization", "aws-pricing", "generate_cost_report", {
"pricing_data": { /* pricing data from get_pricing */ },
"service_name": "Amazon Bedrock",
"format": "markdown"
})
// Returns: Detailed cost analysis report with recommendations
Query S3 Storage Lens data:
usePower("aws-cost-optimization", "aws-billing-cost-management", "storage_lens", {
"query": "SELECT bucket_name, SUM(CAST(metric_value AS BIGINT)) as total_size FROM {table} WHERE metric_name = 'StorageBytes' GROUP BY bucket_name ORDER BY total_size DESC LIMIT 10"
})
// Returns: Top 10 S3 buckets by storage size
Execute custom SQL analysis:
usePower("aws-cost-optimization", "aws-billing-cost-management", "session_sql", {
"query": "SELECT service, SUM(cost) as total_cost FROM cost_data GROUP BY service ORDER BY total_cost DESC"
})
// Returns: Custom cost analysis results from session database
Discover cost-related metrics:
usePower("aws-cost-optimization", "awslabs.cloudwatch-mcp-server", "list_metrics", {
"namespace": "AWS/EC2",
"metric_name": "CPUUtilization"
})
// Returns: Available EC2 CPU metrics for rightsizing analysis
Analyze resource utilization for cost optimization:
usePower("aws-cost-optimization", "awslabs.cloudwatch-mcp-server", "get_metric_statistics", {
"namespace": "AWS/EC2",
"metric_name": "CPUUtilization",
"dimensions": [{"Name": "InstanceId", "Value": "i-1234567890abcdef0"}],
"start_time": "2024-11-01T00:00:00Z",
"end_time": "2024-12-01T00:00:00Z",
"period": 3600,
"statistics": ["Average", "Maximum"]
})
// Returns: CPU utilization data for rightsizing decisions
Create cost efficiency calculations:
usePower("aws-cost-optimization", "awslabs.cloudwatch-mcp-server", "get_metric_data", {
"metric_data_queries": [
{
"id": "cpu_util",
"metric_stat": {
"metric": {
"namespace": "AWS/EC2",
"metric_name": "CPUUtilization",
"dimensions": [{"Name": "InstanceId", "Value": "i-1234567890abcdef0"}]
},
"period": 3600,
"stat": "Average"
}
},
{
"id": "cost_efficiency",
"expression": "cpu_util / 100 * FILL(cpu_util, 0)"
}
],
"start_time": "2024-11-01T00:00:00Z",
"end_time": "2024-12-01T00:00:00Z"
})
// Returns: Cost efficiency metrics combining utilization and cost data
Monitor cost-related alarms:
usePower("aws-cost-optimization", "awslabs.cloudwatch-mcp-server", "describe_alarms", {
"alarm_name_prefix": "HighCost",
"state_value": "ALARM"
})
// Returns: Active cost-related alarms requiring attention
Analyze log-based cost events:
usePower("aws-cost-optimization", "awslabs.cloudwatch-mcp-server", "start_query", {
"log_group_name": "/aws/lambda/my-function",
"start_time": "2024-11-01T00:00:00Z",
"end_time": "2024-12-01T00:00:00Z",
"query_string": "fields @timestamp, @duration, @billedDuration | filter @duration > 5000 | stats count() by bin(5m)"
})
// Returns: Query ID for analyzing Lambda execution patterns affecting costs
---
🎯 Not sure which tool to use? Use our tool selection guide:
Call action "readSteering" with powerName="aws-cost-optimization", steeringFile="tool-selection-guide.md" for query-to-tool mapping and workflow guidance.
The tool selection guide provides:
---
This power includes workflow guidance for both business teams and developers, organized around the AWS Well-Architected Cost Optimization Pillar's 5 design principles:
For detailed cost optimization guidance on individual AWS services, see our service guides:
High-Priority Services (Start Here):
Additional Services Available:
Call action "readSteering" with powerName="aws-cost-optimization", steeringFile="services/README.md" to see available service guides, then read specific service files like "services/ec2-cost-optimization.md" for detailed guidance.
Design Principle 1: Implement Cloud Financial Management
Design Principle 2: Adopt a Consumption Model
Design Principle 3: Measure Overall Efficiency
Design Principle 4: Stop Spending Money on Undifferentiated Heavy Lifting
Design Principle 5: Analyze and Attribute Expenditure
Cost-aware development workflows and patterns
---
---
This power is released under the Apache-2.0 License. See the LICENSE file for full terms.
This power requires AWS credentials to function and processes AWS cost and usage data on your behalf. By using this power:
This power incorporates the following AWS Labs MCP servers under Apache-2.0 license:
For detailed information about the individual MCP servers, please refer to their respective documentation linked in the Available MCP Servers section.
---
Problem: CloudWatch metrics or logs not accessible
Symptoms:
Solutions:
1. Verify CloudWatch permissions:
aws cloudwatch list-metrics --namespace AWS/EC2 --max-records 1
2. Check log group permissions:
aws logs describe-log-groups --max-items 1
3. Ensure proper IAM policies include CloudWatch and Logs permissions
4. Verify region consistency between queries and resources
Problem: MCP servers show expired token errors even when AWS CLI works fine.
Root Cause: MCP servers use AWS credential files (~/.aws/credentials) rather than environment variables, and may cache old credentials even after restart.
Solution:
1. Update AWS credential file with fresh credentials:
# Edit ~/.aws/credentials file directly
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEY
aws_session_token = YOUR_SESSION_TOKEN # If using temporary credentials
2. Restart MCP servers in Kiro to pick up new credentials
3. Verify credentials work:
aws sts get-caller-identity
Note: Environment variables (export AWS_ACCESS_KEY_ID=...) alone are not sufficient for MCP servers. The credential file must be updated for MCP servers to authenticate properly.
---
---
For issues with the AWS Cost Optimization Power:
1. Check your AWS credentials are valid
2. Verify AWS CLI and UV are installed
3. Review the troubleshooting section above