"AMI Remover" is a simple tool to delete AMI and snapshots.
$ bundle install
Please set either. (See also: Configuring the AWS CLI)
$ export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID
$ export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
By default, it only displays the AMI ID. (-v
or --verbose
is verbose mode.)
$ bundle exec ruby ami-remover.rb --region <region> [-v|--verbose]
If you want to delete, please add a remove option.
$ bundle exec ruby ami-remover.rb --region <region> [-r|--remove]
-d
,--days
: Exclude AMI created within x days.--include-tag
: Includes the specified tag name.--exclude-tag
: Excludes the specified tag name.
--include-tag
and --exclude-tag
can not be used together.
For example, delete the AMI that is older than 365 days and has a Project
tag.
$ bundle exec ruby ami-remover.rb --region ap-northeast-1 -r -d 365 --include-tag Project
This software is released under the MIT License.