Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"""Replace 'name' tag with 'Name' and 'application' with 'Application'
"""
import boto3
def uppercaseTagKeys(arn, name, application=None):
tags = {}
if name:
tags['Name'] = name
if application:
tags['Application'] = application
if tags:
client.tag_resource(
Resource=arn,
Tags=tags
)
# it seems there's no way to delete tags at the moment,
# see https://github.com/boto/boto3/issues/2018
for region in ['sa-east-1', 'us-west-2']:
client = boto3.client('lambda', region_name=region)
for func in client.list_functions()['Functions']:
arn = func['FunctionArn']
tags = client.list_tags(Resource=arn)['Tags']
print ("%s had tags %s" % (arn, str(tags)))
name = tags.get('name', None)
application = tags.get('application', None)
uppercaseTagKeys(arn, name, application)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.