Giter Site home page Giter Site logo

Clearing AMI without tag about aws-amicleaner HOT 3 OPEN

bonclay7 avatar bonclay7 commented on September 23, 2024 8
Clearing AMI without tag

from aws-amicleaner.

Comments (3)

kvz avatar kvz commented on September 23, 2024 1

I think you can, by pointing the --mapping-key to name instead of tags, check out this example:

❯ amicleaner --full-report --keep-previous 10 --mapping-key name --mapping-values tosip

Default values : ==>
mapping_key : name
mapping_values : ['tosip']
excluded_mapping_values : []
keep_previous : 10
ami_min_days : -1

Retrieving AMIs to clean ...
tosip
+-----------------------+-------------------------------------------------+--------------------------+
|         AMI ID        |                     AMI Name                    |      Creation Date       |
+-----------------------+-------------------------------------------------+--------------------------+
| ami-02eabc57a5f347de1 |    tosip-main-14-ec2-ebs200-20181108T084515Z    | 2018-11-08T08:58:22.000Z |
| ami-0d24a5c4950e88866 |    tosip-main-14-ec2-ebs200-20181108T150902Z    | 2018-11-08T15:21:59.000Z |
| ami-0a5e8c0adb7f23435 |     tosip-main-14-ec2-ebs200-20181126T142411    | 2018-11-26T14:37:46.000Z |
...

It would appear that it does require you to know a (part of) the name of the instances you want to clean up.

from aws-amicleaner.

jmilliron avatar jmilliron commented on September 23, 2024

Apparently not. Bummer.

from aws-amicleaner.

jamesinc avatar jamesinc commented on September 23, 2024

I think you could pipe the command output, something like

amicleaner --full-report | grep -woE "ami\-[0-9a-z]+" | xargs -L1 echo "aws ec2 deregister-image --image-id"

And then you could copy/paste the CLI commands back into a console.

I think after that you could then use amicleaner --check-orphans to clean up any associated snapshots.

Edit: just tried this and it all worked as above

from aws-amicleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.