boto3 mentioned on Github that they added support for deleting tags. However, when I execute the code below, it throws an exception:
ec2 = boto3.resource('ec2', region_name=aws_region)
ec2.delete_tags(Resources=[instance.id],Tags=[{"Key": non_compliant_tag_name}])
'ec2.ServiceResource' object has no attribute 'delete_tags'
$ pip show boto3
Name: boto3
Version: 1.4.4
What am I doing wrong?
The delete_tags()
method should be called on a client
object rather than a resource
object:
import boto3
client = boto3.client('ec2', region_name='ap-southeast-2')
...
client.delete_tags(Resources=[instance.id],Tags=[{"Key": non_compliant_tag_name}])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With