Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Cleanup tool for AWS AMIs and snapshots

Project Description

Cleanup your old unused ami and related snapshots


This tools permits to clean your custom Amazon Machine Images (AMI) and related EBS Snapshots.

You can either run in fetch and clean mode where the tool will retrieve all your private AMIs and EC2 instances, exclude AMIs being holded by your EC2 instances (it can be useful if you use autoscaling, and so on …). It applies a filter based on their names or tags and a number of previous AMIs you want to keep. You can also check and delete EBS snapshots left orphaned by manual deletion of AMIs.

It can simply remove AMIs with a list of provided ids.


This tool assumes your AWS credentials sourced, either with aws credentials variables :

export AWS_DEFAULT_REGION='your region'
export AWS_ACCESS_KEY_ID='with token Access ID'
export AWS_SECRET_ACCESS_KEY='with token AWS Secret'

or with awscli :

export AWS_PROFILE=profile-name

Minimum AWS IAM permissions

To run the script properly, your aws user must have at least these permissions in iam:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Stmt1458638250000",
            "Effect": "Allow",
            "Action": [
            "Resource": [


amicleaner is available on pypi and can be installed on your system

From pypi

[sudo] pip install aws-amicleaner

From source

You can also clone or download from github the source and install with pip

cd aws-amicleaner/
pip install [--user] -e .


Getting help

amicleaner --help

Fetch and clean

Print report of groups and amis to be cleaned

amicleaner --full-report

Keep previous number of AMIs

amicleaner --full-report --keep-previous 10

Regroup by name or tags

amicleaner --mapping-key tags --mapping-values role env

Skip confirmation, can be useful for automation

amicleaner -f --keep-previous 2

Activate orphan snapshots checking

amicleaner --check-orphans

Delete a list of AMIs

amicleaner --from-ids ami-abcdef01 ami-abcdef02


0.1.0 (2016-08-22)

  • First release on PyPI.

0.1.1 (2016-08-22)

  • Documentation update
  • rst files in pip package
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aws-amicleaner-0.1.2.tar.gz (15.0 kB) Copy SHA256 Checksum SHA256 Source Sep 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting