跳到正文
Skillpedia
部署与云(DevOps)40k · #7073

aws-cost-optimize

它能做什么

这个工具会分析你在亚马逊云科技(AWS)上的资源,找出省钱的方法。它会提出修改建议,并在 GitHub 项目管理系统中创建任务,方便你跟踪改进进度。

适用场景

  • ✓当你想降低每月的 AWS 账单金额时。
  • ✓在 AWS 上部署新服务之前,确认它们的成本是否合理。
  • ✓当你怀疑自己在 AWS 上花费过多,想找出原因时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/aws-cost-optimize/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/aws-cost-optimize/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“分析一下我的 AWS 账户,告诉我怎样才能省钱,并把任务创建到我的 GitHub 仓库里。”

每周 5 个新技能,1 分钟读完。

工作原理

它会检查你正在使用哪些 AWS 服务,将它们与省钱的最佳实践进行对比,找出可以优化的地方。然后,它会自动创建详细的任务,供你逐项落实这些节省方案。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

AWS Cost Optimize

This workflow analyzes Infrastructure-as-Code (IaC) files and AWS resources to generate cost optimization recommendations. It creates individual GitHub issues for each optimization opportunity plus one EPIC issue to coordinate implementation, enabling efficient tracking and execution of cost savings initiatives.

Prerequisites

  • AWS CLI configured and authenticated (aws sts get-caller-identity succeeds)
  • GitHub MCP server configured and authenticated
  • Target GitHub repository identified
  • AWS resources deployed (IaC files optional but helpful)

Workflow Steps

Step 1: Get AWS Cost Optimization Best Practices

Action: Retrieve cost optimization best practices before analysis Tools: fetch to retrieve AWS documentation Process:

  1. Load Best Practices:
    • Fetch https://docs.aws.amazon.com/cost-management/latest/userguide/cost-optimization-best-practices.html
    • Fetch the AWS Well-Architected Cost Optimization pillar summary
    • Use these practices to inform subsequent analysis and recommendations

Step 2: Discover AWS Infrastructure

Action: Dynamically discover and analyze AWS resources and configurations Tools: AWS CLI + Local file system access Process:

  1. Account & Region Discovery:

    • Execute aws sts get-caller-identity to confirm account
    • Execute aws configure get region to determine default region
  2. Resource Discovery (per region):

    • EC2 instances: aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,InstanceType,State.Name,Tags]'
    • RDS instances: aws rds describe-db-instances --query 'DBInstances[].[DBInstanceIdentifier,DBInstanceClass,Engine,MultiAZ]'
    • Lambda functions: aws lambda list-functions --query 'Functions[].[FunctionName,Runtime,MemorySize,Architectures]'
    • ECS clusters/services: aws ecs list-clusters then aws ecs describe-services
    • S3 buckets: aws s3api list-buckets --query 'Buckets[].Name'
    • ElastiCache clusters: aws elasticache describe-cache-clusters
    • NAT Gateways: aws ec2 describe-nat-gateways
    • Load Balancers: aws elbv2 describe-load-balancers
  3. IaC Detection:

    • Scan for IaC files: **/*.tf, **/*.yaml (CloudFormation/SAM), **/*.json (CloudFormation), **/cdk.json, lib/**/*.ts (CDK)
    • Parse resource definitions to understand intended configurations
    • Do NOT use application code files — only IaC files as the source of truth
    • If no IaC files found: STOP and report to user

Step 3: Collect Usage Metrics & Validate Current Costs

Action: Gather utilization data and verify actual resource costs Tools: AWS CLI (CloudWatch, Cost Explorer) Process:

  1. CloudWatch Metrics (last 7 days):

    # EC2 CPU utilization
    aws cloudwatch get-metric-statistics \
      --namespace AWS/EC2 --metric-name CPUUtilization \
      --dimensions Name=InstanceId,Value=<id> \
      --start-time $(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ) \
      --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
      --period 3600 --statistics Average
    
    # Lambda duration
    aws cloudwatch get-metric-statistics \
      --namespace AWS/Lambda --metric-name Duration \
      --dimensions Name=FunctionName,Value=<name> \
      --start-time $(date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ) \
      --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
      --period 86400 --statistics Average,Maximum
    
  2. AWS Cost Explorer:

    aws ce get-cost-and-usage \
      --time-period Start=$(date -u -d '30 days ago' +%Y-%m-%d),End=$(date -u +%Y-%m-%d) \
      --granularity MONTHLY --metrics BlendedCost \
      --group-by Type=DIMENSION,Key=SERVICE
    
  3. Calculate Baseline Metrics: CPU/Memory averages, Lambda invocation rates, data transfer patterns, and a realistic current monthly total.

Step 4: Generate Cost Optimization Recommendations

Action: Analyze resources to identify optimization opportunities Process:

  1. Apply Optimization Patterns:

    Compute:

    • EC2: Right-size based on CPU/memory (<20% average → downsize), convert On-Demand to Savings Plans, migrate to Graviton/ARM (up to 40% cheaper)
    • Lambda: Reduce memory for idle functions, switch to arm64 (20% cheaper)
    • ECS/EKS: Use Fargate Spot for dev/batch workloads

    Database:

    • RDS: Right-size instance class, convert single-AZ for dev, use Aurora Serverless v2 for variable load
    • DynamoDB: Switch Provisioned → On-Demand for unpredictable traffic

…

常见问题

使用这个工具必须有我的 IaC 文件吗?

不是必须的,但如果有描述 AWS 基础设施的代码文件,工具就能更好地理解你的架构,给出更准确的建议。

什么是 IaC 文件?

IaC 是“基础设施即代码”(Infrastructure as Code)的缩写。它指的是用代码来描述服务器、数据库等 IT 基础设施的文件,而不是手动去配置。常见的例子有 Terraform、CloudFormation 或 CDK 文件。

工具找到省钱机会之后会发生什么?

它会在你的 GitHub 仓库中创建任务(issue)。一个总任务(EPIC)会汇总所有建议,而每个具体的省钱机会则对应一个小任务,详细说明该怎么做。

详情

作者的原始描述

Analyze AWS resources used in the app (IaC files and/or resources in a target account/region) and optimize costs - creating GitHub issues for identified optimizations.

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7073
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能