Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an "-included-mapping-values" option #86

Open
yogeek opened this issue Jun 13, 2018 · 0 comments
Open

Add an "-included-mapping-values" option #86

yogeek opened this issue Jun 13, 2018 · 0 comments

Comments

@yogeek
Copy link

yogeek commented Jun 13, 2018

Hello,

First thank you for this useful tool :-)
I would like to delete all AMIs with a tag "usage" equals to "test".
Currently, as I think I understand the tool, it is not possible to do this. It is only possible to delete AMIs with specific tags (with --mapping-key tags --mapping-values <tag_names>) and to exclude some AMI that have a specific value for a tag (with -excluded-mapping-values <tag_values>.

It would be useful to add an option like "-included-mapping-values" to be able to delete AMIs that specifically matches some tag values.
For example, with the current syntax, it could be like :

# Delete all AMIs with a tag "usage" equals to "test"
amicleaner --mapping-key tags --mapping-values usage -included-mapping-values test

# Delete all AMIs with a tag "usage" equals to "test" and a tag "env" equals to "stage"
amicleaner --mapping-key tags --mapping-values usage env -included-mapping-values test stage

# Delete all AMIs with a tag "usage" equals to "test" and a tag "env" equals to "stage" except those with a tag "keep" equals to "true"
amicleaner --mapping-key tags --mapping-values usage env -included-mapping-values test stage -excluded-mapping-values 

But the syntax can quickly become unconvenient for advanced request so I think that it will maybe be easier to pass to a key=value list for include or exclude (based on AWS filters syntax) :

amicleaner --include-filters name=aminame,tag:key1=value1,tag:key2=value2,... --exclude-filters tag:key3=value3,tag:key4=value4,...

Do you think it may be a good and feasible idea ?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant