{"id":"0b6da645-f3dd-4dcd-a1af-8258e618bff1","shortId":"dQg49Z","kind":"skill","title":"aws-cost-cleanup","tagline":"Automated cleanup of unused AWS resources to reduce costs","description":"# AWS Cost Cleanup\n\nAutomate the identification and removal of unused AWS resources to eliminate waste.\n\n## When to Use This Skill\n\nUse this skill when you need to automatically clean up unused AWS resources to reduce costs and eliminate waste.\n\n## Automated Cleanup Targets\n\n**Storage**\n- Unattached EBS volumes\n- Old EBS snapshots (>90 days)\n- Incomplete multipart S3 uploads\n- Old S3 versions in versioned buckets\n\n**Compute**\n- Stopped EC2 instances (>30 days)\n- Unused AMIs and associated snapshots\n- Unused Elastic IPs\n\n**Networking**\n- Unused Elastic Load Balancers\n- Unused NAT Gateways\n- Orphaned ENIs\n\n## Cleanup Scripts\n\n### Safe Cleanup (Dry-Run First)\n\n```bash\n#!/bin/bash\n# cleanup-unused-ebs.sh\n\necho \"Finding unattached EBS volumes...\"\nVOLUMES=$(aws ec2 describe-volumes \\\n  --filters Name=status,Values=available \\\n  --query 'Volumes[*].VolumeId' \\\n  --output text)\n\nfor vol in $VOLUMES; do\n  echo \"Would delete: $vol\"\n  # Uncomment to actually delete:\n  # aws ec2 delete-volume --volume-id $vol\ndone\n```\n\n```bash\n#!/bin/bash\n# cleanup-old-snapshots.sh\n\nCUTOFF_DATE=$(date -d '90 days ago' --iso-8601)\n\naws ec2 describe-snapshots --owner-ids self \\\n  --query \"Snapshots[?StartTime<='$CUTOFF_DATE'].[SnapshotId,StartTime,VolumeSize]\" \\\n  --output text | while read snap_id start_time size; do\n  \n  echo \"Snapshot: $snap_id (Created: $start_time, Size: ${size}GB)\"\n  # Uncomment to delete:\n  # aws ec2 delete-snapshot --snapshot-id $snap_id\ndone\n```\n\n```bash\n#!/bin/bash\n# release-unused-eips.sh\n\naws ec2 describe-addresses \\\n  --query 'Addresses[?AssociationId==null].[AllocationId,PublicIp]' \\\n  --output text | while read alloc_id public_ip; do\n  \n  echo \"Would release: $public_ip ($alloc_id)\"\n  # Uncomment to release:\n  # aws ec2 release-address --allocation-id $alloc_id\ndone\n```\n\n### S3 Lifecycle Automation\n\n```bash\n# Apply lifecycle policy to transition old objects to cheaper storage\ncat > lifecycle-policy.json <<EOF\n{\n  \"Rules\": [\n    {\n      \"Id\": \"Archive old objects\",\n      \"Status\": \"Enabled\",\n      \"Transitions\": [\n        {\n          \"Days\": 90,\n          \"StorageClass\": \"STANDARD_IA\"\n        },\n        {\n          \"Days\": 180,\n          \"StorageClass\": \"GLACIER\"\n        }\n      ],\n      \"NoncurrentVersionExpiration\": {\n        \"NoncurrentDays\": 30\n      },\n      \"AbortIncompleteMultipartUpload\": {\n        \"DaysAfterInitiation\": 7\n      }\n    }\n  ]\n}\nEOF\n\naws s3api put-bucket-lifecycle-configuration \\\n  --bucket my-bucket \\\n  --lifecycle-configuration file://lifecycle-policy.json\n```\n\n## Cost Impact Calculator\n\n```python\n#!/usr/bin/env python3\n# calculate-savings.py\n\nimport boto3\nfrom datetime import datetime, timedelta\n\nec2 = boto3.client('ec2')\n\n# Calculate EBS volume savings\nvolumes = ec2.describe_volumes(\n    Filters=[{'Name': 'status', 'Values': ['available']}]\n)\n\ntotal_size = sum(v['Size'] for v in volumes['Volumes'])\nmonthly_cost = total_size * 0.10  # $0.10/GB-month for gp3\n\nprint(f\"Unattached EBS Volumes: {len(volumes['Volumes'])}\")\nprint(f\"Total Size: {total_size} GB\")\nprint(f\"Monthly Savings: ${monthly_cost:.2f}\")\n\n# Calculate Elastic IP savings\naddresses = ec2.describe_addresses()\nunused = [a for a in addresses['Addresses'] if 'AssociationId' not in a]\n\neip_cost = len(unused) * 3.65  # $0.005/hour * 730 hours\nprint(f\"\\nUnused Elastic IPs: {len(unused)}\")\nprint(f\"Monthly Savings: ${eip_cost:.2f}\")\n\nprint(f\"\\nTotal Monthly Savings: ${monthly_cost + eip_cost:.2f}\")\nprint(f\"Annual Savings: ${(monthly_cost + eip_cost) * 12:.2f}\")\n```\n\n## Automated Cleanup Lambda\n\n```python\nimport boto3\nfrom datetime import datetime, timedelta\n\ndef lambda_handler(event, context):\n    ec2 = boto3.client('ec2')\n    \n    # Delete unattached volumes older than 7 days\n    volumes = ec2.describe_volumes(\n        Filters=[{'Name': 'status', 'Values': ['available']}]\n    )\n    \n    cutoff = datetime.now() - timedelta(days=7)\n    deleted = 0\n    \n    for vol in volumes['Volumes']:\n        create_time = vol['CreateTime'].replace(tzinfo=None)\n        if create_time < cutoff:\n            try:\n                ec2.delete_volume(VolumeId=vol['VolumeId'])\n                deleted += 1\n                print(f\"Deleted volume: {vol['VolumeId']}\")\n            except Exception as e:\n                print(f\"Error deleting {vol['VolumeId']}: {e}\")\n    \n    return {\n        'statusCode': 200,\n        'body': f'Deleted {deleted} volumes'\n    }\n```\n\n## Cleanup Workflow\n\n1. **Discovery Phase** (Read-only)\n   - Run all describe commands\n   - Generate cost impact report\n   - Review with team\n\n2. **Validation Phase**\n   - Verify resources are truly unused\n   - Check for dependencies\n   - Notify resource owners\n\n3. **Execution Phase** (Dry-run first)\n   - Run cleanup scripts with dry-run\n   - Review proposed changes\n   - Execute actual cleanup\n\n4. **Verification Phase**\n   - Confirm deletions\n   - Monitor for issues\n   - Document savings\n\n## Safety Checklist\n\n- [ ] Run in dry-run mode first\n- [ ] Verify resources have no dependencies\n- [ ] Check resource tags for ownership\n- [ ] Notify stakeholders before deletion\n- [ ] Create snapshots of critical data\n- [ ] Test in non-production first\n- [ ] Have rollback plan ready\n- [ ] Document all deletions\n\n## Example Prompts\n\n**Discovery**\n- \"Find all unused resources and calculate potential savings\"\n- \"Generate a cleanup report for my AWS account\"\n- \"What resources can I safely delete?\"\n\n**Execution**\n- \"Create a script to cleanup unattached EBS volumes\"\n- \"Delete all snapshots older than 90 days\"\n- \"Release unused Elastic IPs\"\n\n**Automation**\n- \"Set up automated cleanup for old snapshots\"\n- \"Create a Lambda function for weekly cleanup\"\n- \"Schedule monthly resource cleanup\"\n\n## Integration with AWS Organizations\n\n```bash\n# Run cleanup across multiple accounts\nfor account in $(aws organizations list-accounts \\\n  --query 'Accounts[*].Id' --output text); do\n  \n  echo \"Checking account: $account\"\n  aws ec2 describe-volumes \\\n    --filters Name=status,Values=available \\\n    --profile account-$account\ndone\n```\n\n## Monitoring and Alerts\n\n```bash\n# Create CloudWatch alarm for cost anomalies\naws cloudwatch put-metric-alarm \\\n  --alarm-name high-cost-alert \\\n  --alarm-description \"Alert when daily cost exceeds threshold\" \\\n  --metric-name EstimatedCharges \\\n  --namespace AWS/Billing \\\n  --statistic Maximum \\\n  --period 86400 \\\n  --evaluation-periods 1 \\\n  --threshold 100 \\\n  --comparison-operator GreaterThanThreshold\n```\n\n## Best Practices\n\n- Schedule cleanup during maintenance windows\n- Always create final snapshots before deletion\n- Use resource tags to identify cleanup candidates\n- Implement approval workflow for production\n- Log all cleanup actions for audit\n- Set up cost anomaly detection\n- Review cleanup results weekly\n\n## Risk Mitigation\n\n**Medium Risk Actions:**\n- Deleting unattached volumes (ensure no planned reattachment)\n- Removing old snapshots (verify no compliance requirements)\n- Releasing Elastic IPs (check DNS records)\n\n**Always:**\n- Maintain 30-day backup retention\n- Use AWS Backup for critical resources\n- Test restore procedures\n- Document cleanup decisions\n\n## Kiro CLI Integration\n\n```bash\n# Analyze and cleanup in one command\nkiro-cli chat \"Use aws-cost-cleanup to find and remove unused resources\"\n\n# Generate cleanup script\nkiro-cli chat \"Create a safe cleanup script for my AWS account\"\n\n# Schedule automated cleanup\nkiro-cli chat \"Set up weekly automated cleanup using aws-cost-cleanup\"\n```\n\n## Additional Resources\n\n- [AWS Resource Cleanup Best Practices](https://aws.amazon.com/blogs/mt/automate-resource-cleanup/)\n- [AWS Systems Manager Automation](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation.html)\n- [AWS Config Rules for Compliance](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html)\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["aws","cost","cleanup","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding"],"capabilities":["skill","source-sickn33","skill-aws-cost-cleanup","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/aws-cost-cleanup","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34964 github stars · SKILL.md body (8,140 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-25T00:50:29.681Z","embedding":null,"createdAt":"2026-04-18T21:31:42.567Z","updatedAt":"2026-04-25T00:50:29.681Z","lastSeenAt":"2026-04-25T00:50:29.681Z","tsv":"'-8601':165 '/bin/bash':108,155,218 '/blogs/mt/automate-resource-cleanup/)':951 '/config/latest/developerguide/managed-rules-by-aws-config.html)':966 '/gb-month':362 '/hour':412 '/systems-manager/latest/userguide/systems-manager-automation.html)':958 '/usr/bin/env':321 '0':489 '0.005':411 '0.10':360,361 '1':513,541,794 '100':796 '12':447 '180':292 '2':558 '200':533 '2f':386,428,438,448 '3':572 '3.65':410 '30':79,297,868 '4':592 '7':300,473,487 '730':413 '86400':790 '90':63,161,287,682 'abortincompletemultipartupload':298 'account':661,716,718,724,726,733,734,746,747,924 'across':714 'action':829,845 'actual':142,590 'addit':942 'address':224,226,254,391,393,399,400 'ago':163 'alarm':755,764,766,773 'alarm-descript':772 'alarm-nam':765 'alert':751,771,775 'alloc':235,245,256,258 'allocation-id':255 'allocationid':229 'alway':808,866 'ami':82 'analyz':888 'annual':441 'anomali':758,835 'appli':265 'approv':822 'archiv':280 'ask':1000 'associ':84 'associationid':227,402 'audit':831 'autom':5,17,53,263,449,688,691,926,935,955 'automat':41 'avail':125,345,482,744 'aw':2,9,14,24,45,116,144,166,206,220,250,302,660,709,720,735,759,873,900,923,939,944,952,959 'aws-cost-cleanup':1,899,938 'aws.amazon.com':950 'aws.amazon.com/blogs/mt/automate-resource-cleanup/)':949 'aws/billing':786 'backup':870,874 'balanc':93 'bash':107,154,217,264,711,752,887 'best':801,947 'bodi':534 'boto3':325,454 'boto3.client':332,466 'boundari':1008 'bucket':74,306,309,312 'calcul':319,334,387,651 'calculate-savings.py':323 'candid':820 'cat':275 'chang':588 'chat':897,915,931 'cheaper':273 'check':566,616,732,863 'checklist':603 'clarif':1002 'clean':42 'cleanup':4,6,16,54,99,102,450,539,580,591,656,673,692,702,706,713,804,819,828,838,882,890,902,910,919,927,936,941,946 'cleanup-old-snapshots.sh':156 'cleanup-unused-ebs.sh':109 'clear':975 'cli':885,896,914,930 'cloudwatch':754,760 'command':550,893 'comparison':798 'comparison-oper':797 'complianc':858,963 'comput':75 'config':960 'configur':308,315 'confirm':595 'context':464 'cost':3,13,15,49,317,357,385,407,427,435,437,444,446,552,757,770,778,834,901,940 'creat':197,495,503,625,669,696,753,809,916 'createtim':498 'criteria':1011 'critic':628,876 'cutoff':157,178,483,505 'd':160 'daili':777 'data':629 'date':158,159,179 'datetim':327,329,456,458 'datetime.now':484 'day':64,80,162,286,291,474,486,683,869 'daysafteriniti':299 'decis':883 'def':460 'delet':138,143,147,205,209,468,488,512,516,527,536,537,596,624,642,667,677,813,846 'delete-snapshot':208 'delete-volum':146 'depend':568,615 'describ':119,169,223,549,738,979 'describe-address':222 'describe-snapshot':168 'describe-volum':118,737 'descript':774 'detect':836 'discoveri':542,645 'dns':864 'docs.aws.amazon.com':957,965 'docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html)':964 'docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation.html)':956 'document':600,640,881 'done':153,216,260,748 'dri':104,576,584,607 'dry-run':103,575,583,606 'e':523,530 'eb':58,61,113,335,368,675 'ec2':77,117,145,167,207,221,251,331,333,465,467,736 'ec2.delete':507 'ec2.describe':339,392,476 'echo':110,136,193,240,731 'eip':406,426,436,445 'elast':87,91,388,418,686,861 'elimin':27,51 'enabl':284 'eni':98 'ensur':849 'environ':991 'environment-specif':990 'eof':277,301 'error':526 'estimatedcharg':784 'evalu':792 'evaluation-period':791 'event':463 'exampl':643 'exceed':779 'except':520,521 'execut':573,589,668 'expert':996 'f':366,374,381,416,423,430,440,515,525,535 'filter':121,341,478,740 'final':810 'find':111,646,904 'first':106,578,610,635 'function':699 'gateway':96 'gb':202,379 'generat':551,654,909 'glacier':294 'gp3':364 'greaterthanthreshold':800 'handler':462 'high':769 'high-cost-alert':768 'hour':414 'ia':290 'id':151,173,188,196,213,215,236,246,257,259,279,727 'identif':19 'identifi':818 'impact':318,553 'implement':821 'import':324,328,453,457 'incomplet':65 'input':1005 'instanc':78 'integr':707,886 'ip':88,238,244,389,419,687,862 'iso':164 'issu':599 'kiro':884,895,913,929 'kiro-c':894,912,928 'lambda':451,461,698 'len':370,408,420 'lifecycl':262,266,307,314 'lifecycle-configur':313 'lifecycle-policy.json':276,316 'limit':967 'list':723 'list-account':722 'load':92 'log':826 'maintain':867 'mainten':806 'manag':954 'match':976 'maximum':788 'medium':843 'metric':763,782 'metric-nam':781 'miss':1013 'mitig':842 'mode':609 'monitor':597,749 'month':356,382,384,424,432,434,443,704 'multipart':66 'multipl':715 'my-bucket':310 'name':122,342,479,741,767,783 'namespac':785 'nat':95 'need':39 'network':89 'non':633 'non-product':632 'noncurrentday':296 'noncurrentversionexpir':295 'none':501 'notifi':569,621 'ntotal':431 'null':228 'nunus':417 'object':271,282 'old':60,69,270,281,694,854 'older':471,680 'one':892 'oper':799 'organ':710,721 'orphan':97 'output':129,183,231,728,985 'owner':172,571 'owner-id':171 'ownership':620 'period':789,793 'permiss':1006 'phase':543,560,574,594 'plan':638,851 'polici':267 'potenti':652 'practic':802,948 'print':365,373,380,415,422,429,439,514,524 'procedur':880 'product':634,825 'profil':745 'prompt':644 'propos':587 'public':237,243 'publicip':230 'put':305,762 'put-bucket-lifecycle-configur':304 'put-metric-alarm':761 'python':320,452 'python3':322 'queri':126,175,225,725 'read':186,234,545 'read-on':544 'readi':639 'reattach':852 'record':865 'reduc':12,48 'releas':242,249,253,684,860 'release-address':252 'release-unused-eips.sh':219 'remov':21,853,906 'replac':499 'report':554,657 'requir':859,1004 'resourc':10,25,46,562,570,612,617,649,663,705,815,877,908,943,945 'restor':879 'result':839 'retent':871 'return':531 'review':555,586,837,997 'risk':841,844 'rollback':637 'rule':278,961 'run':105,547,577,579,585,604,608,712 's3':67,70,261 's3api':303 'safe':101,666,918 'safeti':602,1007 'save':337,383,390,425,433,442,601,653 'schedul':703,803,925 'scope':978 'script':100,581,671,911,920 'self':174 'set':689,832,932 'size':191,200,201,347,350,359,376,378 'skill':33,36,970 'skill-aws-cost-cleanup' 'snap':187,195,214 'snapshot':62,85,170,176,194,210,212,626,679,695,811,855 'snapshot-id':211 'snapshotid':180 'source-sickn33' 'specif':992 'stakehold':622 'standard':289 'start':189,198 'starttim':177,181 'statist':787 'status':123,283,343,480,742 'statuscod':532 'stop':76,998 'storag':56,274 'storageclass':288,293 'substitut':988 'success':1010 'sum':348 'system':953 'tag':618,816 'target':55 'task':974 'team':557 'test':630,878,994 'text':130,184,232,729 'threshold':780,795 'time':190,199,496,504 'timedelta':330,459,485 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'total':346,358,375,377 'transit':269,285 'treat':983 'tri':506 'truli':564 'tzinfo':500 'unattach':57,112,367,469,674,847 'uncom':140,203,247 'unus':8,23,44,81,86,90,94,394,409,421,565,648,685,907 'upload':68 'use':31,34,814,872,898,937,968 'v':349,352 'valid':559,993 'valu':124,344,481,743 'verif':593 'verifi':561,611,856 'version':71,73 'vol':132,139,152,491,497,510,518,528 'volum':59,114,115,120,127,134,148,150,336,338,340,354,355,369,371,372,470,475,477,493,494,508,517,538,676,739,848 'volume-id':149 'volumeid':128,509,511,519,529 'volumes':182 'wast':28,52 'week':701,840,934 'window':807 'workflow':540,823 'would':137,241","prices":[{"id":"40479cd1-7f20-44df-bf25-b23c30e95985","listingId":"0b6da645-f3dd-4dcd-a1af-8258e618bff1","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:31:42.567Z"}],"sources":[{"listingId":"0b6da645-f3dd-4dcd-a1af-8258e618bff1","source":"github","sourceId":"sickn33/antigravity-awesome-skills/aws-cost-cleanup","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/aws-cost-cleanup","isPrimary":false,"firstSeenAt":"2026-04-18T21:31:42.567Z","lastSeenAt":"2026-04-25T00:50:29.681Z"}],"details":{"listingId":"0b6da645-f3dd-4dcd-a1af-8258e618bff1","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"aws-cost-cleanup","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34964,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"475364153585bc58ca9a01f59b11495240daffad","skill_md_path":"skills/aws-cost-cleanup/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/aws-cost-cleanup"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"aws-cost-cleanup","description":"Automated cleanup of unused AWS resources to reduce costs"},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/aws-cost-cleanup"},"updatedAt":"2026-04-25T00:50:29.681Z"}}