This code will fetch all your CBS volumes and delete all volumes except:
- Those volumes created between the last 24 hours (according to the name)
- The last volume of each 15th day in the month
{
"AWS": {
"config": {
"accessKeyId": "REPLACE_ACCESS_KEY_ID",
"secretAccessKey": "REPLACE_SECRET_ACCESS_KEY",
"region": "REPLACE_AWS_REGION"
}
}
}
npm start
docker-compose up
- Reports are created as csv files
- there are 3 reports, summary, deleted volumes and not deleted volumes
If you have Docker installed just run the script replacing the enviroment variables and let the magic happen
docker run -it --rm -e ACCESS_KEY_ID=[REPLACE] -e SECRET_ACCESS_KEY=[REPLACE] -e AWS_REGION=[REPLACE] jsalgado/aws-ebs-cleanup:latest