Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

aws-cost-cleanupAWS cost cleanup 搜索

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

372

周安装

16

GitHub Stars

52

下载量

131
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:aws-cost-cleanup(AWS cost cleanup 搜索)
来源仓库:https://github.com/aaaaqwq/claude-code-skills
仓库路径:skills/aws-cost-cleanup
安装命令:
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill aws-cost-cleanup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/aaaaqwq/claude-code-skills --skill aws-cost-cleanup

简介

用于自动识别并清理闲置或低效使用的 AWS 资源以减少云支出浪费。

  • 可检测未挂载 EBS 卷、过期快照、未完成上传分片、停止 EC2 实例及孤立 ENI 等资源。
  • 提供安全清理脚本选项,默认执行干跑模式以避免误删关键资产。
  • 运行前需确认资源标签规范与业务归属,排除受保护或重要服务组件。
  • 建议结合预算告警机制定期执行,形成成本治理闭环。

SKILL.md

AWS Cost Cleanup

Automate the identification and removal of unused AWS resources to eliminate waste.

When to Use This Skill

Use this skill when you need to automatically clean up unused AWS resources to reduce costs and eliminate waste.

Automated Cleanup Targets

Storage

  • Unattached EBS volumes
  • Old EBS snapshots (>90 days)
  • Incomplete multipart S3 uploads
  • Old S3 versions in versioned buckets

Compute

  • Stopped EC2 instances (>30 days)
  • Unused AMIs and associated snapshots
  • Unused Elastic IPs

Networking

  • Unused Elastic Load Balancers
  • Unused NAT Gateways
  • Orphaned ENIs

Cleanup Scripts

Safe Cleanup (Dry-Run First)

#!/bin/bash
# cleanup-unused-ebs.sh

echo "Finding unattached EBS volumes..."
VOLUMES=$(aws ec2 describe-volumes \
  --filters Name=status,Values=available \
  --query 'Volumes[*].VolumeId' \
  --output text)

for vol in $VOLUMES; do
  echo "Would delete: $vol"
  # Uncomment to actually delete:
  # aws ec2 delete-volume --volume-id $vol
done
#!/bin/bash
# cleanup-old-snapshots.sh

CUTOFF_DATE=$(date -d '90 days ago' --iso-8601)

aws ec2 describe-snapshots --owner-ids self \
  --query "Snapshots[?StartTime<='$CUTOFF_DATE'].[SnapshotId,StartTime,VolumeSize]" \
  --output text | while read snap_id start_time size; do

  echo "Snapshot: $snap_id (Created: $start_time, Size: ${size}GB)"
  # Uncomment to delete:
  # aws ec2 delete-snapshot --snapshot-id $snap_id
done
#!/bin/bash
# release-unused-eips.sh

aws ec2 describe-addresses \
  --query 'Addresses[?AssociationId==null].[AllocationId,PublicIp]' \
  --output text | while read alloc_id public_ip; do

  echo "Would release: $public_ip ($alloc_id)"
  # Uncomment to release:
  # aws ec2 release-address --allocation-id $alloc_id
done

S3 Lifecycle Automation

# Apply lifecycle policy to transition old objects to cheaper storage
cat > lifecycle-policy.json <<EOF
{
  "Rules": [
    {
      "Id": "Archive old objects",
      "Status": "Enabled",
      "Transitions": [
        {
          "Days": 90,
          "StorageClass": "STANDARD_IA"
        },
        {
          "Days": 180,
          "StorageClass": "GLACIER"
        }
      ],
      "NoncurrentVersionExpiration": {
        "NoncurrentDays": 30
      },
      "AbortIncompleteMultipartUpload": {
        "DaysAfterInitiation": 7
      }
    }
  ]
}
EOF

aws s3api put-bucket-lifecycle-configuration \
  --bucket my-bucket \
  --lifecycle-configuration file://lifecycle-policy.json

Cost Impact Calculator

#!/usr/bin/env python3
# calculate-savings.py

import boto3
from datetime import datetime, timedelta

ec2 = boto3.client('ec2')

# Calculate EBS volume savings
volumes = ec2.describe_volumes(
    Filters=[{'Name': 'status', 'Values': ['available']}]
)

total_size = sum(v['Size'] for v in volumes['Volumes'])
monthly_cost = total_size * 0.10  # $0.10/GB-month for gp3

print(f"Unattached EBS Volumes: {len(volumes['Volumes'])}")
print(f"Total Size: {total_size} GB")
print(f"Monthly Savings: ${monthly_cost:.2f}")

# Calculate Elastic IP savings
addresses = ec2.describe_addresses()
unused = [a for a in addresses['Addresses'] if 'AssociationId' not in a]

eip_cost = len(unused) * 3.65  # $0.005/hour * 730 hours
print(f"\nUnused Elastic IPs: {len(unused)}")
print(f"Monthly Savings: ${eip_cost:.2f}")

print(f"\nTotal Monthly Savings: ${monthly_cost + eip_cost:.2f}")
print(f"Annual Savings: ${(monthly_cost + eip_cost) * 12:.2f}")

Automated Cleanup Lambda

import boto3
from datetime import datetime, timedelta

def lambda_handler(event, context):
    ec2 = boto3.client('ec2')

    # Delete unattached volumes older than 7 days
    volumes = ec2.describe_volumes(
        Filters=[{'Name': 'status', 'Values': ['available']}]
    )

    cutoff = datetime.now() - timedelta(days=7)
    deleted = 0

    for vol in volumes['Volumes']:
        create_time = vol['CreateTime'].replace(tzinfo=None)
        if create_time < cutoff:
            try:
                ec2.delete_volume(VolumeId=vol['VolumeId'])
                deleted += 1
                print(f"Deleted volume: {vol['VolumeId']}")
            except Exception as e:
                print(f"Error deleting {vol['VolumeId']}: {e}")

    return {
        'statusCode': 200,
        'body': f'Deleted {deleted} volumes'
    }

Cleanup Workflow

  1. Discovery Phase (Read-only)

- Run all describe commands - Generate cost impact report - Review with team

  1. Validation Phase

- Verify resources are truly unused - Check for dependencies - Notify resource owners

  1. Execution Phase (Dry-run first)

- Run cleanup scripts with dry-run - Review proposed changes - Execute actual cleanup

  1. Verification Phase

- Confirm deletions - Monitor for issues - Document savings

Safety Checklist

  • Run in dry-run mode first
  • Verify resources have no dependencies
  • Check resource tags for ownership
  • Notify stakeholders before deletion
  • Create snapshots of critical data
  • Test in non-production first
  • Have rollback plan ready
  • Document all deletions

Example Prompts

Discovery

  • "Find all unused resources and calculate potential savings"
  • "Generate a cleanup report for my AWS account"
  • "What resources can I safely delete?"

Execution

  • "Create a script to cleanup unattached EBS volumes"
  • "Delete all snapshots older than 90 days"
  • "Release unused Elastic IPs"

Automation

  • "Set up automated cleanup for old snapshots"
  • "Create a Lambda function for weekly cleanup"
  • "Schedule monthly resource cleanup"

Integration with AWS Organizations

# Run cleanup across multiple accounts
for account in $(aws organizations list-accounts \
  --query 'Accounts[*].Id' --output text); do

  echo "Checking account: $account"
  aws ec2 describe-volumes \
    --filters Name=status,Values=available \
    --profile account-$account
done

Monitoring and Alerts

# Create CloudWatch alarm for cost anomalies
aws cloudwatch put-metric-alarm \
  --alarm-name high-cost-alert \
  --alarm-description "Alert when daily cost exceeds threshold" \
  --metric-name EstimatedCharges \
  --namespace AWS/Billing \
  --statistic Maximum \
  --period 86400 \
  --evaluation-periods 1 \
  --threshold 100 \
  --comparison-operator GreaterThanThreshold

Best Practices

  • Schedule cleanup during maintenance windows
  • Always create final snapshots before deletion
  • Use resource tags to identify cleanup candidates
  • Implement approval workflow for production
  • Log all cleanup actions for audit
  • Set up cost anomaly detection
  • Review cleanup results weekly

Risk Mitigation

Medium Risk Actions:

  • Deleting unattached volumes (ensure no planned reattachment)
  • Removing old snapshots (verify no compliance requirements)
  • Releasing Elastic IPs (check DNS records)

Always:

  • Maintain 30-day backup retention
  • Use AWS Backup for critical resources
  • Test restore procedures
  • Document cleanup decisions

Kiro CLI Integration

# Analyze and cleanup in one command
kiro-cli chat "Use aws-cost-cleanup to find and remove unused resources"

# Generate cleanup script
kiro-cli chat "Create a safe cleanup script for my AWS account"

# Schedule automated cleanup
kiro-cli chat "Set up weekly automated cleanup using aws-cost-cleanup"

Additional Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.5%
按下载量换算49

Claude

30.65%
按下载量换算40

Cursor

20.34%
按下载量换算27

Gemini CLI

9.46%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills