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。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 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-identitysucceeds) - 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:
- 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
- Fetch
Step 2: Discover AWS Infrastructure
Action: Dynamically discover and analyze AWS resources and configurations Tools: AWS CLI + Local file system access Process:
Account & Region Discovery:
- Execute
aws sts get-caller-identityto confirm account - Execute
aws configure get regionto determine default region
- Execute
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-clustersthenaws 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
- EC2 instances:
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
- Scan for IaC files:
Step 3: Collect Usage Metrics & Validate Current Costs
Action: Gather utilization data and verify actual resource costs Tools: AWS CLI (CloudWatch, Cost Explorer) Process:
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,MaximumAWS 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=SERVICECalculate 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:
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
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。