Created
March 20, 2020 18:24
-
-
Save packetchef/6ae33926d7e42756afeaf8102f64fc16 to your computer and use it in GitHub Desktop.
Return the value for a tag with a specific name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tags = [{'Key': 'Name', 'Value': 'tag testing'}, {'Key': 'Ec2ImageBuilderArn', 'Value': 'arn:aws:imagebuilder:us-east-1:123412341234:image/my-build/1.0.0/1'}] | |
nameTagKey = 'Name' | |
tagName = [ x['Value'] for x in tags if x['Key'] == nameTagKey ][0] | |
# Should return 'tag testing' | |
print(tagName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment