Create Image - Adding Tags or Filtering Tags

286 views
Skip to first unread message

Jacob Coleman

unread,
Jun 15, 2015, 2:06:45 PM6/15/15
to boto-...@googlegroups.com
Hi everyone!

I'm attempting to create an AMI from an instance, and then assign it tags so that AMI can then be manipulated by other parts of a script. When I attempt to add_tags to the create_image, i.e.:

ami = conn.create_image(blah, blah, blah)
ami.add_tag({tag stuff}) 

It gives me an error stating that add_tags isn't a part of create_image. I've tried then pulling down a list of images to add tags to, but cannot do a partial match on a filter it seems:

conn.get_all_images(filters={'description': 'DRBackup*'})

Any advice on solving both issues?

Adrian Klaver

unread,
Jun 15, 2015, 2:35:01 PM6/15/15
to boto-...@googlegroups.com
On 06/15/2015 11:00 AM, Jacob Coleman wrote:
> Hi everyone!
>
> I'm attempting to create an AMI from an instance, and then assign it
> tags so that AMI can then be manipulated by other parts of a script.
> When I attempt to add_tags to the create_image, i.e.:
>
> ami = conn.create_image(blah, blah, blah)
> ami.add_tag({tag stuff})
>
> It gives me an error stating that add_tags isn't a part of create_image.

Because it is not. Take the image_id returned from create_image and then
use get_image(image_id) to get the actual image and use image.add_tag()

http://boto.readthedocs.org/en/latest/ref/ec2.html

> I've tried then pulling down a list of images to add tags to, but cannot
> do a partial match on a filter it seems:
>
> conn.get_all_images(filters={'description': 'DRBackup*'})

conn.get_all_images(filters={'tag:description': 'DRBackup*'})

>
> Any advice on solving both issues?
>
> --
> You received this message because you are subscribed to the Google
> Groups "boto-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to boto-users+...@googlegroups.com
> <mailto:boto-users+...@googlegroups.com>.
> To post to this group, send email to boto-...@googlegroups.com
> <mailto:boto-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/boto-users.
> For more options, visit https://groups.google.com/d/optout.


--
Adrian Klaver
adrian...@aklaver.com

Jacob Coleman

unread,
Jun 16, 2015, 9:21:39 AM6/16/15
to boto-...@googlegroups.com
Thank you so much!
Reply all
Reply to author
Forward
0 new messages