How can I tag an AWS Lambda function using boto3

Viewed 3558

I have code that creates a boto3 client of type 'lambda'. I then use that client to call the list_functions(), create_function(), and update_function() methods. That all works well as outlined in this documentation: http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.list_functions

But when i go to use the list_tags() or tag_resource() methods outline here: http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.list_tags

I get an error saying:

AttributeError: 'Lambda' object has no attribute 'list_tags'

what am I doing wrong? Those methods are listed on the same doc page so I figure they are called on the same client. What gives:

    l = boto3.client(
    'lambda',
    region_name='us-east-1', 
    aws_access_key_id = 'AletitgoQ',
    aws_secret_access_key = 'XvHowdyW',
)
    l.list_tags(
         Resource="myArn"
        )        

    l.tag_resource(
            Resource="myArn",
            Tags={
                'action': 'test'
          }
      )

To make matters worse, I don't appear to be able to include the tags in the create_function() call despite what the docs say about that here: http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.create_function

when i include tags in the call i get this response:

botocore.exceptions.ParamValidationError: Parameter validation failed: Unknown parameter in input: "Tags", must be one of: FunctionName, Runtime, Role, Handler, Code, Description, Timeout, MemorySize, Publish, VpcConfig, DeadLetterConfig, Environment, KMSKeyArn

compare that list to what is shown in the boto3 docs and you see that a few things are missing at the end there including tags

I'm in python 2.7 and pip confirms my boto3 is 1.4.4

1 Answers
Related