jeudi 14 juillet 2016

How can I get the value of the EC2 instance tag "Name" with boto?


I'm working from the instance id. I can get the tags, but I can't figure out how filter on both the instance id and the tag "Name" or index in and return the value of the tag called "Name" I ended up grabbing all tags and iterating over them till I find the one I want, which can't possibly be right. tags = conn.get_all_tags({'resource-id': instance_id}) for tag in tags: if 'Name' in tag.name: name = tag.value

Aucun commentaire:

Enregistrer un commentaire