본문으로 건너뛰기
Skillpedia
자동화48k · #3854

aws-cost-cleanup

하는 일

사용하지 않는 Amazon Web Services(AWS) 자원을 찾아 제거하도록 돕는 도구입니다. 필요 없는 것에 돈을 내지 않도록 해서 비용을 아껴 줍니다.

사용하는 경우

  • ✓AWS 지출을 줄이고 싶을 때.
  • ✓어떤 자원이 더는 필요 없다고 확신할 때.
  • ✓잊힌 항목으로 어수선한 AWS 계정을 정리하고 싶을 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-cost-cleanup/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-cost-cleanup/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 AWS 계정에서 쓰지 않는 자원을 찾아서 절약할 수 있는 금액을 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 사용하지 않는 스토리지 디스크, 오래 중지된 인스턴스, 아무것에도 연결되지 않은 IP 주소 같은 자원을 확인합니다. 이 항목들을 나열하고 예상 비용 절감액을 계산합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

…

자주 묻는 질문

도구가 어떤 종류의 자원을 찾을 수 있나요?

연결되지 않은 스토리지 디스크(EBS), 오래된 스냅샷, 완료되지 않은 S3 업로드, 오래된 S3 파일 버전, 30일 넘게 중지된 인스턴스, 사용하지 않는 AMI, 사용하지 않는 Elastic IP, 로드 밸런서, NAT 게이트웨이, 고아 네트워크 인터페이스(ENI)를 찾을 수 있습니다.

도구가 자원을 자동으로 삭제하나요?

도구는 삭제하도록 설정할 수 있지만, 먼저 ‘드라이 런’을 실행해 무엇이 삭제될지 확인하는 것을 권장합니다. 수동 삭제나 S3용 수명 주기 규칙을 위한 스크립트도 제공합니다.

중요한 것을 실수로 삭제하지 않으려면 어떻게 해야 하나요?

‘안전 체크리스트’를 꼭 따라야 합니다. 항상 시뮬레이션 모드로 먼저 실행하고, 자원에 종속성이 없는지 확인하고, 태그로 소유자를 확인하고, 관계자에게 알리는 것이 좋습니다. 가능하면 운영 환경이 아닌 곳에서 테스트한 뒤 영구 삭제하는 것이 좋습니다.

상세 정보

작성자의 원본 설명

Automated cleanup of unused AWS resources to reduce costs

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#3854
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬