Drop Nuclear Bomb on your AWS account. How to clear your entire AWS services in 3 seconds.
Looking at my back account transaction history, I found AWS continues to spend more than $7 per month. It was because of the services attached while studying AWS lambda in the past. You would share my opinion. AWS itself is a universe. It’s really hard to figure out what services I enabled and not… So, I found the great tool to solve my problem.
I introduce you cloud-nuke
.
Prerequisite
- Make sure you are a mac user.
Install Brew
# Run the command below
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This is optional. You can install cloud-nuke
another way. But I recommend you to use brew
. Brew is the most useful tool to manage your packages on mac.
Install ‘cloud-nuke’ with ‘brew’
# install cloud-nuke
brew install cloud-nuke
Prepare your credential
# Run this command on terminal
export AWS_ACCESS_KEY="YOUR_AWS_ACCESS_KEY"
export AWS_SECRET_KEY="YOUR_AWS_SECRET_KEY"
export AWS_REGION="YOUR_REGION"
Completely Clear Your Account With a Single Commandline!
# Run the command and say goodbye to your existing services
cloud-nuke aws
That’s all.
Explore Additional Features
# Delete all services in Seoul, (delete specific region)
cloud-nuke aws --region ap-northeast-3# List all available resources
cloud-nuke aws --list-resource-types# Exclude some resources
cloud-nuke aws --exclude-resource-type s3 --exclude-resource-type ec2# Simulate `cloud-nuke` with `--dry-run`. It's going to tell you what's going to happen by not actually deleting your resources
cloud-nuke aws --resource-type ec2 --dry-run
How Do I Get AWS Credential? — OPTIONAL
1) Go To IAM
2) Tab on Users
on left menu and click on Add users
.
3) Enter User name
of your choice and check Access key — Programmatic access
4) Create Group If you don’t have any and grant Administrator Permission
.
5) Skip tags and Create user
6) Check your credential and save it in the safe place.
Conclusion
- install
cloud-nuke
- Provide
aws credentials
- run
cloud-nuke aws
That’s all!
Please, leave me a comment if you have any question!