Index of every page on this site: llms.txt
All skills
lassejlv avatar

/aws-account-cleanup

@72a388a
by Lasselassejlv/skills70 stars
2
Run it yourself

Safely inventory and remove AWS account resources with mandatory dry-run-first discovery and explicit human confirmations. Use when the user asks to nuke, empty, clean up, delete everything in, or selectively remove resources from an AWS account, including destructive AWS cleanup, account teardown preparation, sandbox reset, or cost cleanup.

Use this Skill: https://skilld.dev/gh/lassejlv/skills/aws-account-cleanup

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈91 tokens for metadata: the name and description. ≈1.4k when used: this file. ≈756 more on demand in 2 files.

Description uses 4.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈365 characters, or 4.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

AWS Account Cleanup

Non-Negotiable Safety Flow

Treat this skill as destructive infrastructure work. Never delete, disable, detach, terminate, destroy, empty, or modify AWS resources until the required confirmations are complete.

  1. Confirm access before touching AWS:
    • Ask the user exactly: please confirm i have access to go through your aws account
    • Do not run AWS commands before this confirmation, including read-only inventory commands.
  2. Identify the active account and credentials after the user confirms:
    • Run aws sts get-caller-identity.
    • Report the account ID, ARN, and active AWS profile or environment source if detectable.
    • Stop if the identity does not clearly match the intended account.
  3. Perform a dry run only:
    • Inventory resources across all enabled regions.
    • Prefer read-only list, describe, get, and tagging API calls.
    • Do not use commands with side effects, even if they have --dry-run, unless the command is strictly necessary to test delete permissions and cannot change state.
  4. Summarize findings before deletion:
    • Group findings by service, region, and resource identifier.
    • Include obvious blockers such as termination protection, non-empty buckets, retained snapshots, protected log groups, service-linked roles, and root-account-only actions.
    • Ask the user to choose all or list exact resources, services, regions, or categories to remove.
  5. Confirm deletion scope before deleting:
    • Ask exactly: please confirm delete xxx from your xxx account
    • Replace the first xxx with the precise deletion scope, such as all discovered EC2 instances and unattached EBS volumes in eu-west-1.
    • Replace the second xxx with the account ID or clearly identified account alias/profile.
    • Do not accept vague confirmation when the scope changed after the dry-run summary.
  6. Delete only the confirmed scope:
    • Work in dependency order.
    • Re-check each target immediately before deletion.
    • Skip anything not present in the dry-run summary unless the user explicitly adds it and confirms the updated scope.
  7. Verify and report:
    • Re-run read-only inventory for the confirmed scope.
    • Report deleted, skipped, failed, and still-present resources.
    • Include exact follow-up commands or console actions only for resources that could not be removed automatically.

Dry-Run Inventory

Start with aws sts get-caller-identity, then enumerate regions:

aws ec2 describe-regions --all-regions --query 'Regions[?OptInStatus==`opt-in-not-required` || OptInStatus==`opted-in`].RegionName' --output text

For a broad cleanup, inspect common cost-bearing and dependency-heavy services first:

  • EC2: instances, launch templates, AMIs owned by self, EBS volumes, snapshots, elastic IPs, NAT gateways, load balancers, target groups, security groups, key pairs.
  • VPC: VPCs, subnets, route tables, internet gateways, egress-only gateways, NAT gateways, VPC endpoints, peering connections, network ACLs.
  • S3: buckets, regions, versioning, object counts when feasible, lifecycle, replication, public access blocks.
  • RDS and databases: DB instances, clusters, snapshots, subnet groups, parameter groups, option groups.
  • ECS/EKS: clusters, services, tasks, node groups, Fargate profiles.
  • Lambda and eventing: functions, layers, event source mappings, EventBridge rules and schedules.
  • IAM: users, access keys, roles, policies, groups, instance profiles, OIDC/SAML providers. Treat IAM as global and high-risk.
  • Logs and observability: CloudWatch log groups, alarms, dashboards, X-Ray groups.
  • Secrets and config: Secrets Manager secrets, SSM parameters, AppConfig resources.
  • DNS and edge: Route 53 hosted zones and records, CloudFront distributions, ACM certificates, WAF resources.
  • Deployment services: CloudFormation stacks, Elastic Beanstalk apps, CodeBuild projects, CodePipeline pipelines.

Read references/aws-inventory.md when a concrete command checklist is useful.

Deletion Order

Delete high-level orchestrators before their underlying resources when they own dependencies:

  1. CloudFormation, CDK-managed stacks, Elastic Beanstalk, ECS services, EKS node groups, and other deployment managers.
  2. Application front doors and compute: load balancers, target groups, ECS tasks/services, Lambda integrations, EC2 instances.
  3. Network dependencies: NAT gateways, VPC endpoints, peering, internet gateways, subnets, route tables, security groups, VPCs.
  4. Storage and databases: RDS instances/clusters, snapshots if confirmed, EBS volumes/snapshots, EFS file systems, S3 buckets after object and version cleanup.
  5. Global services: CloudFront, Route 53, IAM, ACM us-east-1 certificates, WAF, global accelerator.
  6. Logs, alarms, secrets, parameters, retained backups, and leftover service artifacts.

For all, interpret the request as all resources found in the dry run, not every possible AWS service. If new resources are discovered during deletion, pause, summarize them, and request a new confirmation.

Refusal and Escalation Rules

  • Refuse to proceed if the user asks to skip either confirmation phrase.
  • Refuse to delete from an account that cannot be identified with sts get-caller-identity.
  • Ask for a narrower scope when the dry-run results are too large or ambiguous to summarize precisely.
  • Avoid closing the AWS account itself unless the user explicitly asks; account closure may require console/root actions and has billing, support, and organization side effects.
  • Preserve evidence: keep command output summaries or saved inventory files if the user asks for an audit trail.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    This skill is a utility for managing and cleaning up AWS accounts. It incorporates strong safety protocols, including mandatory dry runs, identity verification using 'sts get-caller-identity', and explicit multi-step confirmation prompts before any destructive actions are performed. No malicious patterns or unauthorized data exfiltration attempts were detected.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at 72a388a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated 5 months ago

README badge

README badge for lassejlv/skills/aws-account-cleanup