Friday, June 10, 2022

Nuke all resources in aws

 Option 1:


without any config, delete all the resources, internally may be using option 2.


https://github.com/gruntwork-io/cloud-nuke

Below will cleanup eveything in the account.

If any errors, will retry for some time gap and delete. If still error, shows in the console

Steps:

wget https://github.com/gruntwork-io/cloud-nuke/releases/download/v0.11.8/cloud-nuke_linux_amd64
sudo mv cloud-nuke_linux_amd64 /usr/local/bin/cloud-nuke
sudo chmod u+x /usr/local/bin/cloud-nuke
cloud-nuke aws


Option 2:
https://github.com/rebuy-de/aws-nuke

Need a config file for the cleanup to happen.

nuke-config.yml



regions:
- "regionid"

account-blocklist:
- "accountid"

resource-types:
 targets:
 - ELB
 - ELBv2
 - S3Bucket
 - EKSCluster
 - EKSFargateProfiles
 - EKSNodegroups
 - AutoScalingGroup
 - AutoScalingPlansScalingPlan
 - EC2Volume
 - StorageGatewayVolume
 - EC2Instance
 - EC2InternetGateway
 - EC2InternetGatewayAttachment
 - EC2KeyPair
 - EC2NATGateway
 - EC2NetworkACL
 - EC2NetworkInterface
 - EC2PlacementGroup
 - EC2RouteTable
 - EC2SecurityGroup
 - EC2Subnet
 - EC2VPC
 - EC2Address
 #- EC2DHCPOption
 - EC2VPCEndpoint
 - EC2VPCEndpointServiceConfiguration

accounts:
 accountid: {}

command:

aws-nuke -c nuke-config.yml --no-dry-run --force --force-sleep 15

No comments:

Post a Comment