-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 instance delete_tags() method #381
Comments
Thanks for reporting, we'll look into adding it |
Thanks, looking forward to it. |
you delete tag in boto3 by setting a tag with a value of None |
I'm not able to set the Value key to None. I'm getting a type error. Any other way to remove a tag? |
@mlapida You just omit Value |
Could you guys give a quick code example? |
The Tag resource was incorrectly modeled such that it is not a collection on an Instance. As a result, there is no way to batch delete tags from an Instance resource. This adds that functionality in, in a way that won't break on future EC2 resource changes. In the long term there are plans to codify SDK specific customizations while maintaining a canonically correct resource model, but that will sometime in the future as part of a different story. Fixes boto#381
Fantastic! Can you please link to documentation to show how it works now? |
Here's the doc section. import boto3
ec2 = boto3.client('ec2')
instance = ec2.Instance('id')
# Delete the tag 'foo' if it has value 'bar'
instance.delete_tags(Tags=[{"Key": "foo", "Value": "bar"}])
# Delete the tag 'baz' if it exists
instance.delete_tags(Tags=[{"Key": "baz"}])
# Delete all tags
instance.delete_tags() |
Awesome. You guys are |
This is dandy, but some other resources are missing |
So in boto there was instance.add_tag() and instance.remove_tag().
In boto3 there is instance.create_tags() but no corresponding delete_tag()s.
the client resource has delete_tags but the method should exist for the instance object.
Discussion?
The text was updated successfully, but these errors were encountered: