Skip to content

Instantly share code, notes, and snippets.

@garnaat
Created February 6, 2012 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save garnaat/1751670 to your computer and use it in GitHub Desktop.
Save garnaat/1751670 to your computer and use it in GitHub Desktop.
Add a new/value tag to an instance
>>> import boto
>>> c = boto.connect_ec2()
>>> reservations = c.get_all_instances()
>>> reservations
[Reservation:r-b73716d6]
>>> instance = reservations[0].instances[0]
>>> instance
Instance:i-366c4354
>>> instance.tags
{}
>>> instance.add_tag('foo', 'bar')
>>> instance.tags
{'foo': 'bar'}
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment