← Back

---

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 Power


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.


Introduction


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.


Table of Contents



What Can You Do?


For Business & FinOps Teams


1. Cloud Financial Management


Example: "Show me our organizational cost breakdown by business unit"


2. Cost Analysis & Forecasting


Example: "Compare our costs between last quarter and this quarter"


3. Optimization & Governance


Example: "Find cost optimization opportunities across our organization"


For Developers & Engineering Teams


4. Pre-Deployment Cost Analysis


Example: "Provide cost estimates for this CDK stack before I deploy it"


5. Development Environment Optimization


Example: "Analyze costs for our development environments"


6. Cost-Aware Development


Example: "Compare Lambda vs ECS costs for my microservice architecture"


---


Quick Start


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"


---


Available MCP Servers


awslabs.billing-cost-management-mcp-server

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/


awslabs.aws-pricing-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/


awslabs.cloudwatch-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/


---


Available Tools


The AWS Cost Optimization Power provides these tools across two MCP servers:


Cost Analysis & Forecasting


Optimization & Recommendations


Budget & Anomaly Monitoring


Reserved Capacity Analysis


Pricing Intelligence


Infrastructure Cost Analysis


Advanced Analytics


Operational Monitoring & Insights


---


Onboarding


Prerequisites


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)


Step 1: Configure AWS Credentials


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:


Option A: AWS CLI Configure


aws configure

Enter your Access Key ID, Secret Access Key, default region, and output format.


Option B: Environment Variables


export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-east-1

Option C: AWS SSO


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.


Step 2: Enable Cost Explorer (if not already enabled)


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


Step 3: Configure Billing and Monitoring Permissions


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": "*"
        }
    ]
}

Step 4: Start Using the Power


Once credentials are configured, you can immediately start using the power:


---


Tool Usage Examples


Cost Analysis & Forecasting


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

Optimization Recommendations


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

Budget & Anomaly Monitoring


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

Reserved Capacity Analysis


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

Pricing Intelligence


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

Infrastructure Cost Analysis


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

Advanced Analytics


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

Operational Monitoring & Cost Correlation


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

---


Tool Selection & Navigation Guide


🎯 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:


---


Workflows & Guidance


This power includes workflow guidance for both business teams and developers, organized around the AWS Well-Architected Cost Optimization Pillar's 5 design principles:


Service-Specific Optimization Guides


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.


For Business & FinOps Teams


💼 [Cloud Financial Management](./steering/cloud-financial-management.md)

Design Principle 1: Implement Cloud Financial Management


🔄 [Consumption Model Optimization](./steering/consumption-model.md)

Design Principle 2: Adopt a Consumption Model


📊 [Efficiency Measurement](./steering/efficiency-measurement.md)

Design Principle 3: Measure Overall Efficiency


⚙️ [Managed Services Optimization](./steering/managed-services-optimization.md)

Design Principle 4: Stop Spending Money on Undifferentiated Heavy Lifting


🏷️ [Expenditure Attribution](./steering/expenditure-attribution.md)

Design Principle 5: Analyze and Attribute Expenditure


For Developers & Engineering Teams


👨‍💻 [Developer Cost Optimization](./steering/developer-cost-optimization.md)

Cost-aware development workflows and patterns


---


Best Practices


✅ Do:



❌ Don't:



---


Legal and Compliance Information


License

This power is released under the Apache-2.0 License. See the LICENSE file for full terms.


Authentication and Data Processing

This power requires AWS credentials to function and processes AWS cost and usage data on your behalf. By using this power:


Disclaimers


Third-Party Dependencies

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.


---


Troubleshooting


"Access Denied" Errors


"No Data Available" Errors


MCP Server Connection Issues


CloudWatch Access Issues

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


"ExpiredTokenException" or MCP Credential Issues

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.


---


Learn More



---


Support


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