Created
July 11, 2022 19:47
-
-
Save pjaudiomv/254c36db2575706167f4445409e32ab8 to your computer and use it in GitHub Desktop.
Convert boto3 tags to a dict
This file contains hidden or 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': 'Environment', 'Value': 'staging'}, | |
{'Key': 'Name', 'Value': 'STAGING TOOLS'} | |
] | |
tag_dict = {tag['Key']: tag['Value'] for tag in tags} | |
# { | |
# "Environment": "staging", | |
# "Name": "STAGING TOOLS" | |
# } | |
def instance_tags(instance): | |
return {tag['Key']: tag['Value'] for tag in instance.tags} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment