aws-cost-finops by ahmedasmar/devops-claude-skills
npx skills add https://github.com/ahmedasmar/devops-claude-skills --skill aws-cost-finops用于 AWS 成本优化和财务运营管理的系统化工作流。
在以下情况下使用此技能:
遵循此系统化方法进行 AWS 成本优化:
┌─────────────────────────────────────────────┐
│ 1. 发现 │
│ 我们的钱花在哪里? │
│ 运行:find_unused_resources.py │
│ 运行:cost_anomaly_detector.py │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 2. 分析 │
│ 优化机会在哪里? │
│ 运行:rightsizing_analyzer.py │
│ 运行:detect_old_generations.py │
│ 运行:spot_recommendations.py │
│ 运行:analyze_ri_recommendations.py │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 3. 优先级排序 │
│ 我们应该首先优化什么? │
│ - 快速见效(低风险,高节省) │
│ - 低垂果实(易于实施) │
│ - 战略性改进 │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 4. 实施 │
│ 执行优化操作 │
│ - 删除未使用的资源 │
│ - 调整实例规模 │
│ - 购买承诺 │
│ - 迁移到新世代 │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 5. 监控 │
│ 验证节省并跟踪指标 │
│ - 月度成本审查 │
│ - 标记合规性监控 │
│ - 预算差异跟踪 │
└─────────────────────────────────────────────┘
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
频率:每月运行(每月第一周)
步骤 1:查找未使用的资源
# 扫描所有资源中的浪费
python3 scripts/find_unused_resources.py
# 预期输出:
# - 未挂载的 EBS 卷
# - 旧快照
# - 未使用的弹性 IP
# - 闲置的 NAT 网关
# - 闲置的 EC2 实例
# - 未使用的负载均衡器
# - 预估月度节省
步骤 2:分析成本异常
# 检测异常支出模式
python3 scripts/cost_anomaly_detector.py --days 30
# 预期输出:
# - 成本激增和异常
# - 主要成本驱动因素
# - 周期对比
# - 30 天预测
步骤 3:识别调整规模的机会
# 查找过大的实例
python3 scripts/rightsizing_analyzer.py --days 30
# 预期输出:
# - 利用率低的 EC2 实例
# - 利用率低的 RDS 实例
# - 推荐的较小实例类型
# - 预估节省
步骤 4:生成月度报告
# 使用模板汇总发现
cp assets/templates/monthly_cost_report.md reports/$(date +%Y-%m)-cost-report.md
# 填写:
# - 脚本发现
# - 待办事项
# - 团队成本细分
# - 优化成果
步骤 5:团队审查会议
时机:每季度或当使用模式稳定时
步骤 1:分析当前使用情况
# 识别适合承诺的工作负载
python3 scripts/analyze_ri_recommendations.py --days 60
# 查找:
# - 持续运行 60 天以上的 EC2 实例
# - 使用稳定的 RDS 实例
# - 计算 1 年与 3 年承诺的投资回报率
步骤 2:审查推荐
评估每个推荐:
✅ 良好候选者如果:
- 24/7 运行 60 天以上
- 工作负载稳定且可预测
- 无更改架构的计划
- 节省 > 30%
❌ 不良候选者如果:
- 工作负载可变或处于实验阶段
- 计划进行架构更改
- 实例类型可能更改
- 开发/测试环境
步骤 3:选择承诺类型
预留实例:
Savings Plans:
决策矩阵:
已知实例类型,不会更改 → 标准 RI
可能需要更改类型 → 可转换 RI 或 Compute SP
可变工作负载 → Compute Savings Plan
最大灵活性 → Compute Savings Plan
步骤 4:购买和跟踪
参考:有关详细承诺策略,请参阅 references/best_practices.md
时机:在架构审查或优化冲刺期间
步骤 1:检测旧实例
# 查找过时的实例世代
python3 scripts/detect_old_generations.py
# 识别:
# - t2 → t3 迁移(10% 节省)
# - m4 → m5 → m6i 迁移
# - Intel → Graviton 机会(20% 节省)
步骤 2:确定迁移优先级
快速见效(低风险):
t2 → t3:直接替换,10% 节省
m4 → m5:更好的性能,5% 节省
gp2 → gp3:无停机时间,20% 节省
中等工作量(需要测试):
x86 → Graviton (ARM64):20% 节省
- 需要 ARM64 兼容性测试
- 大多数现代框架支持 ARM64
- 首先在预演环境中测试
步骤 3:执行迁移
对于 EC2(x86 到 x86):
对于 Graviton 迁移:
步骤 4:验证节省
参考:请参阅 references/best_practices.md → 计算优化
时机:用于容错工作负载或 Auto Scaling 组
步骤 1:识别候选者
# 分析工作负载的 Spot 适用性
python3 scripts/spot_recommendations.py
# 评估:
# - Auto Scaling 组中的实例(良好候选者)
# - 开发/测试/预演环境
# - 批处理工作负载
# - CI/CD 和构建服务器
步骤 2:评估适用性
非常适合 Spot:
不适合 Spot:
步骤 3:实施策略
选项 1:Fargate Spot(最简单)
# ECS 任务定义
requiresCompatibilities:
- FARGATE
capacityProviderStrategy:
- capacityProvider: FARGATE_SPOT
weight: 70 # 70% Spot
- capacityProvider: FARGATE
weight: 30 # 30% 按需
选项 2:使用 Spot 的 EC2 Auto Scaling
# 混合实例策略
MixedInstancesPolicy:
InstancesDistribution:
OnDemandBaseCapacity: 2
OnDemandPercentageAboveBaseCapacity: 30
SpotAllocationStrategy: capacity-optimized
LaunchTemplate:
Overrides:
- InstanceType: m5.large
- InstanceType: m5a.large
- InstanceType: m5n.large
选项 3:EC2 Spot Fleet
# 创建具有多种实例类型的 Spot Fleet
aws ec2 request-spot-fleet --spot-fleet-request-config file://spot-fleet.json
步骤 4:实施中断处理
# 处理 2 分钟终止通知
# 实例元数据:/latest/meta-data/spot/instance-action
# 在应用程序中:
1. 轮询终止通知
2. 优雅关闭(保存状态)
3. 排空连接
4. 退出
参考:请参阅 references/best_practices.md → 计算优化 → Spot 实例
ls scripts/
# find_unused_resources.py
# analyze_ri_recommendations.py
# detect_old_generations.py
# spot_recommendations.py
# rightsizing_analyzer.py
# cost_anomaly_detector.py
月度审查(运行全部):
python3 scripts/find_unused_resources.py
python3 scripts/cost_anomaly_detector.py --days 30
python3 scripts/rightsizing_analyzer.py --days 30
季度优化:
python3 scripts/analyze_ri_recommendations.py --days 60
python3 scripts/detect_old_generations.py
python3 scripts/spot_recommendations.py
仅特定区域:
python3 scripts/find_unused_resources.py --region us-east-1
python3 scripts/rightsizing_analyzer.py --region us-west-2
命名 AWS 配置文件:
python3 scripts/find_unused_resources.py --profile production
python3 scripts/cost_anomaly_detector.py --profile production --days 60
# 安装依赖项
pip install boto3 tabulate
# 需要 AWS 凭证
# 通过以下方式配置:aws configure
# 或使用:--profile PROFILE_NAME
关键操作:
参考:references/best_practices.md → 计算优化
关键操作:
参考:references/best_practices.md → 存储优化
关键操作:
参考:references/best_practices.md → 网络优化
关键操作:
参考:references/best_practices.md → 数据库优化
需要帮助在服务之间进行选择吗?
问题:"我应该使用 EC2、Lambda 还是 Fargate?" 答案:请参阅 references/service_alternatives.md → 计算替代方案
问题:"我应该使用哪个 S3 存储类?" 答案:请参阅 references/service_alternatives.md → 存储替代方案
问题:"我应该使用 RDS 还是 Aurora?" 答案:请参阅 references/service_alternatives.md → 数据库替代方案
问题:"NAT 网关 vs VPC 端点 vs NAT 实例?" 答案:请参阅 references/service_alternatives.md → 网络替代方案
阶段 1:基础(第 1 个月)
阶段 2:可见性(第 2-3 个月)
阶段 3:文化(持续进行)
完整指南:请参阅 references/finops_governance.md
第 1 周:数据收集
第 2 周:分析
第 3 周:团队审查
第 4 周:执行报告
模板:请参阅 assets/templates/monthly_cost_report.md
详细流程:请参阅 references/finops_governance.md → 月度审查流程
运行成本异常检测:
python3 scripts/cost_anomaly_detector.py --days 30
检查 Cost Explorer 的服务细分
审查 CloudTrail 中的资源创建事件
检查 AutoScaling 事件
验证没有预留实例过期
遵循优化工作流:
运行 RI 分析:
python3 scripts/analyze_ri_recommendations.py --days 60
查找:
运行未使用资源查找器:
python3 scripts/find_unused_resources.py
通常可以安全删除:
90 天的快照(如果备份存在于其他地方)
30 天的已停止 EC2 实例(确认已废弃后)
删除前务必与资源所有者核实!
详细参考:
references/best_practices.md:全面的优化策略references/service_alternatives.md:经济高效的服务选择references/finops_governance.md:组织 FinOps 实践模板:
assets/templates/monthly_cost_report.md:月度报告模板脚本:
scripts/ 目录中,使用 --help 查看用法AWS 文档:
每周安装
66
仓库
GitHub 星标
90
首次出现
Jan 23, 2026
安全审计
安装于
opencode55
gemini-cli51
codex49
claude-code49
github-copilot46
cursor44
Systematic workflows for AWS cost optimization and financial operations management.
Use this skill when you need to:
Follow this systematic approach for AWS cost optimization:
┌─────────────────────────────────────────────┐
│ 1. DISCOVER │
│ What are we spending money on? │
│ Run: find_unused_resources.py │
│ Run: cost_anomaly_detector.py │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 2. ANALYZE │
│ Where are the optimization opportunities?│
│ Run: rightsizing_analyzer.py │
│ Run: detect_old_generations.py │
│ Run: spot_recommendations.py │
│ Run: analyze_ri_recommendations.py │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 3. PRIORITIZE │
│ What should we optimize first? │
│ - Quick wins (low risk, high savings) │
│ - Low-hanging fruit (easy to implement) │
│ - Strategic improvements │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 4. IMPLEMENT │
│ Execute optimization actions │
│ - Delete unused resources │
│ - Rightsize instances │
│ - Purchase commitments │
│ - Migrate to new generations │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ 5. MONITOR │
│ Verify savings and track metrics │
│ - Monthly cost reviews │
│ - Tag compliance monitoring │
│ - Budget variance tracking │
└─────────────────────────────────────────────┘
Frequency : Run monthly (first week of each month)
Step 1: Find Unused Resources
# Scan for waste across all resources
python3 scripts/find_unused_resources.py
# Expected output:
# - Unattached EBS volumes
# - Old snapshots
# - Unused Elastic IPs
# - Idle NAT Gateways
# - Idle EC2 instances
# - Unused load balancers
# - Estimated monthly savings
Step 2: Analyze Cost Anomalies
# Detect unusual spending patterns
python3 scripts/cost_anomaly_detector.py --days 30
# Expected output:
# - Cost spikes and anomalies
# - Top cost drivers
# - Period-over-period comparison
# - 30-day forecast
Step 3: Identify Rightsizing Opportunities
# Find oversized instances
python3 scripts/rightsizing_analyzer.py --days 30
# Expected output:
# - EC2 instances with low utilization
# - RDS instances with low utilization
# - Recommended smaller instance types
# - Estimated savings
Step 4: Generate Monthly Report
# Use the template to compile findings
cp assets/templates/monthly_cost_report.md reports/$(date +%Y-%m)-cost-report.md
# Fill in:
# - Findings from scripts
# - Action items
# - Team cost breakdowns
# - Optimization wins
Step 5: Team Review Meeting
When : Quarterly or when usage patterns stabilize
Step 1: Analyze Current Usage
# Identify workloads suitable for commitments
python3 scripts/analyze_ri_recommendations.py --days 60
# Looks for:
# - EC2 instances running consistently for 60+ days
# - RDS instances with stable usage
# - Calculates ROI for 1yr vs 3yr commitments
Step 2: Review Recommendations
Evaluate each recommendation:
✅ Good candidate if:
- Running 24/7 for 60+ days
- Workload is stable and predictable
- No plans to change architecture
- Savings > 30%
❌ Poor candidate if:
- Workload is variable or experimental
- Architecture changes planned
- Instance type may change
- Dev/test environment
Step 3: Choose Commitment Type
Reserved Instances :
Savings Plans :
Decision Matrix :
Known instance type, won't change → Standard RI
May need to change types → Convertible RI or Compute SP
Variable workloads → Compute Savings Plan
Maximum flexibility → Compute Savings Plan
Step 4: Purchase and Track
Reference : See references/best_practices.md for detailed commitment strategies
When : During architecture reviews or optimization sprints
Step 1: Detect Old Instances
# Find outdated instance generations
python3 scripts/detect_old_generations.py
# Identifies:
# - t2 → t3 migrations (10% savings)
# - m4 → m5 → m6i migrations
# - Intel → Graviton opportunities (20% savings)
Step 2: Prioritize Migrations
Quick Wins (Low Risk) :
t2 → t3: Drop-in replacement, 10% savings
m4 → m5: Better performance, 5% savings
gp2 → gp3: No downtime, 20% savings
Medium Effort (Test Required) :
x86 → Graviton (ARM64): 20% savings
- Requires ARM64 compatibility testing
- Most modern frameworks support ARM64
- Test in staging first
Step 3: Execute Migration
For EC2 (x86 to x86) :
For Graviton Migration :
Step 4: Validate Savings
Reference : See references/best_practices.md → Compute Optimization
When : For fault-tolerant workloads or Auto Scaling Groups
Step 1: Identify Candidates
# Analyze workloads for Spot suitability
python3 scripts/spot_recommendations.py
# Evaluates:
# - Instances in Auto Scaling Groups (good candidates)
# - Dev/test/staging environments
# - Batch processing workloads
# - CI/CD and build servers
Step 2: Assess Suitability
Excellent for Spot :
NOT suitable for Spot :
Step 3: Implementation Strategy
Option 1: Fargate Spot (Easiest)
# ECS task definition
requiresCompatibilities:
- FARGATE
capacityProviderStrategy:
- capacityProvider: FARGATE_SPOT
weight: 70 # 70% Spot
- capacityProvider: FARGATE
weight: 30 # 30% On-Demand
Option 2: EC2 Auto Scaling with Spot
# Mixed instances policy
MixedInstancesPolicy:
InstancesDistribution:
OnDemandBaseCapacity: 2
OnDemandPercentageAboveBaseCapacity: 30
SpotAllocationStrategy: capacity-optimized
LaunchTemplate:
Overrides:
- InstanceType: m5.large
- InstanceType: m5a.large
- InstanceType: m5n.large
Option 3: EC2 Spot Fleet
# Create Spot Fleet with diverse instance types
aws ec2 request-spot-fleet --spot-fleet-request-config file://spot-fleet.json
Step 4: Implement Interruption Handling
# Handle 2-minute termination notice
# Instance metadata: /latest/meta-data/spot/instance-action
# In application:
1. Poll for termination notice
2. Gracefully shutdown (save state)
3. Drain connections
4. Exit
Reference : See references/best_practices.md → Compute Optimization → Spot Instances
ls scripts/
# find_unused_resources.py
# analyze_ri_recommendations.py
# detect_old_generations.py
# spot_recommendations.py
# rightsizing_analyzer.py
# cost_anomaly_detector.py
Monthly Review (Run all) :
python3 scripts/find_unused_resources.py
python3 scripts/cost_anomaly_detector.py --days 30
python3 scripts/rightsizing_analyzer.py --days 30
Quarterly Optimization :
python3 scripts/analyze_ri_recommendations.py --days 60
python3 scripts/detect_old_generations.py
python3 scripts/spot_recommendations.py
Specific Region Only :
python3 scripts/find_unused_resources.py --region us-east-1
python3 scripts/rightsizing_analyzer.py --region us-west-2
Named AWS Profile :
python3 scripts/find_unused_resources.py --profile production
python3 scripts/cost_anomaly_detector.py --profile production --days 60
# Install dependencies
pip install boto3 tabulate
# AWS credentials required
# Configure via: aws configure
# Or use: --profile PROFILE_NAME
Key Actions :
Reference : references/best_practices.md → Compute Optimization
Key Actions :
Reference : references/best_practices.md → Storage Optimization
Key Actions :
Reference : references/best_practices.md → Network Optimization
Key Actions :
Reference : references/best_practices.md → Database Optimization
Need help choosing between services?
Question : "Should I use EC2, Lambda, or Fargate?" Answer : See references/service_alternatives.md → Compute Alternatives
Question : "Which S3 storage class should I use?" Answer : See references/service_alternatives.md → Storage Alternatives
Question : "Should I use RDS or Aurora?" Answer : See references/service_alternatives.md → Database Alternatives
Question : "NAT Gateway vs VPC Endpoint vs NAT Instance?" Answer : See references/service_alternatives.md → Networking Alternatives
Phase 1: Foundation (Month 1)
Phase 2: Visibility (Months 2-3)
Phase 3: Culture (Ongoing)
Full Guide : See references/finops_governance.md
Week 1 : Data Collection
Week 2 : Analysis
Week 3 : Team Reviews
Week 4 : Executive Reporting
Template : See assets/templates/monthly_cost_report.md
Detailed Process : See references/finops_governance.md → Monthly Review Process
Run cost anomaly detection:
python3 scripts/cost_anomaly_detector.py --days 30
Check Cost Explorer for service breakdown
Review CloudTrail for resource creation events
Check for AutoScaling events
Verify no Reserved Instances expired
Follow the optimization workflow:
Run RI analysis:
python3 scripts/analyze_ri_recommendations.py --days 60
Look for:
Run unused resource finder:
python3 scripts/find_unused_resources.py
Safe to delete (usually):
Always verify with resource owner before deletion!
Detailed References :
references/best_practices.md: Comprehensive optimization strategiesreferences/service_alternatives.md: Cost-effective service selectionreferences/finops_governance.md: Organizational FinOps practicesTemplates :
assets/templates/monthly_cost_report.md: Monthly reporting templateScripts :
scripts/ directory with --help for usageAWS Documentation :
Weekly Installs
66
Repository
GitHub Stars
90
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode55
gemini-cli51
codex49
claude-code49
github-copilot46
cursor44
iOS HIG 设计配置 - 遵循苹果人机界面指南的代码库配置工具
1 周安装
iOS Hang Diagnostics - iOS应用卡顿诊断与性能分析工具
1 周安装
Swift Codable 完全指南:JSON 编码解码、自定义策略与实战技巧
84 周安装
iOS Foundation Models 诊断工具 - 模型配置与调试技能 | derklinke/codex-config
1 周安装
iOS基础模型配置工具 - 优化iOS开发与模型集成效率
1 周安装
iOS文件保护配置指南 - 使用derklinke/codex-config增强iOS应用数据安全
1 周安装