AWS Lambda

2015/10/07 - AWS Lambda - 7 new 12 updated api methods

CreateAlias (new) Link ¶

Creates an alias to the specified Lambda function version. For more information, see Introduction to AWS Lambda Aliases

This requires permission for the lambda:CreateAlias action.

Request Syntax

client.create_alias(
    FunctionName='string',
    Name='string',
    FunctionVersion='string',
    Description='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

Name of the Lambda function for which you want to create an alias.

type Name

string

param Name

[REQUIRED]

Name for the alias your creating.

type FunctionVersion

string

param FunctionVersion

[REQUIRED]

Lambda function version for which you are creating the alias.

type Description

string

param Description

Description of the alias.

rtype

dict

returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function version alias.

    • AliasArn (string) --

      Lambda function ARN that is qualified using alias name as the suffix. For example, if you create an alias "BETA" pointing to a helloworld function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA .

    • Name (string) --

      Alias name.

    • FunctionVersion (string) --

      Function version to which the alias points.

    • Description (string) --

      Alias description.

ListVersionsByFunction (new) Link ¶

List all versions of a function.

Request Syntax

client.list_versions_by_function(
    FunctionName='string',
    Marker='string',
    MaxItems=123
)
type FunctionName

string

param FunctionName

[REQUIRED]

Function name whose versions to list. You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Marker

string

param Marker

Optional string. An opaque pagination token returned from a previous ListVersionsByFunction operation. If present, indicates where to continue the listing.

type MaxItems

integer

param MaxItems

Optional integer. Specifies the maximum number of AWS Lambda function versions to return in response. This parameter value must be greater than 0.

rtype

dict

returns

Response Syntax

{
    'NextMarker': 'string',
    'Versions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'java8'|'python2.7',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      A string, present if there are more function versions.

    • Versions (list) --

      A list of Lambda function versions.

      • (dict) --

        A complex type that describes function metadata.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) assigned to the function.

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

        • Handler (string) --

          The function Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size, in bytes, of the function .zip file you uploaded.

        • Description (string) --

          The user-provided description.

        • Timeout (integer) --

          The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

        • MemorySize (integer) --

          The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

        • LastModified (string) --

          The timestamp of the last time you updated the function.

        • CodeSha256 (string) --

          It is the SHA256 hash of your function deployment package.

        • Version (string) --

          The version of the Lambda function.

GetAlias (new) Link ¶

Returns the specified alias information such as the alias ARN, description, and function version it is pointing to. For more information, see Introduction to AWS Lambda Aliases

This requires permission for the lambda:GetAlias action.

Request Syntax

client.get_alias(
    FunctionName='string',
    Name='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

Function name for which the alias is created. An alias is a subresource that exists only in the context of an existing Lambda function. So you must specify the function name.

type Name

string

param Name

[REQUIRED]

Name of the alias for which you want to retrieve information.

rtype

dict

returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function version alias.

    • AliasArn (string) --

      Lambda function ARN that is qualified using alias name as the suffix. For example, if you create an alias "BETA" pointing to a helloworld function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA .

    • Name (string) --

      Alias name.

    • FunctionVersion (string) --

      Function version to which the alias points.

    • Description (string) --

      Alias description.

PublishVersion (new) Link ¶

Publishes a version of your function from the current snapshot of HEAD. That is, AWS Lambda takes a snapshot of the function code and configuration information from HEAD and publishes a new version. The code and handler of this specific Lambda function version cannot be modified after publication, but you can modify the configuration information.

Request Syntax

client.publish_version(
    FunctionName='string',
    CodeSha256='string',
    Description='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function name. You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type CodeSha256

string

param CodeSha256

The SHA256 hash of the deployment package you want to publish. This provides validation on the code you are publishing. If you provide this parameter value must match the SHA256 of the HEAD version for the publication to succeed.

type Description

string

param Description

The description for the version you are publishing. If not provided, AWS Lambda copies the description from the HEAD version.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

UpdateAlias (new) Link ¶

Using this API you can update function version to which the alias points to and alias description. For more information, see Introduction to AWS Lambda Aliases

This requires permission for the lambda:UpdateAlias action.

Request Syntax

client.update_alias(
    FunctionName='string',
    Name='string',
    FunctionVersion='string',
    Description='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The function name for which the alias is created.

type Name

string

param Name

[REQUIRED]

The alias name.

type FunctionVersion

string

param FunctionVersion

Using this parameter you can optionally change the Lambda function version to which the alias to points to.

type Description

string

param Description

You can optionally change the description of the alias using this parameter.

rtype

dict

returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function version alias.

    • AliasArn (string) --

      Lambda function ARN that is qualified using alias name as the suffix. For example, if you create an alias "BETA" pointing to a helloworld function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA .

    • Name (string) --

      Alias name.

    • FunctionVersion (string) --

      Function version to which the alias points.

    • Description (string) --

      Alias description.

DeleteAlias (new) Link ¶

Deletes specified Lambda function alias. For more information, see Introduction to AWS Lambda Aliases

This requires permission for the lambda:DeleteAlias action.

Request Syntax

client.delete_alias(
    FunctionName='string',
    Name='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function name for which the alias is created.

type Name

string

param Name

[REQUIRED]

Name of the alias to delete.

returns

None

ListAliases (new) Link ¶

Returns list of aliases created for a Lambda function. For each alias, the response includes information such as the alias ARN, description, alias name, and the function version to which it points. For more information, see Introduction to AWS Lambda Aliases

This requires permission for the lambda:ListAliases action.

Request Syntax

client.list_aliases(
    FunctionName='string',
    FunctionVersion='string',
    Marker='string',
    MaxItems=123
)
type FunctionName

string

param FunctionName

[REQUIRED]

Lambda function name for which the alias is created.

type FunctionVersion

string

param FunctionVersion

If you specify this optional parameter, the API returns only the aliases pointing to the specific Lambda function version, otherwise returns all aliases created for the Lambda function.

type Marker

string

param Marker

Optional string. An opaque pagination token returned from a previous ListAliases operation. If present, indicates where to continue the listing.

type MaxItems

integer

param MaxItems

Optional integer. Specifies the maximum number of aliases to return in response. This parameter value must be greater than 0.

rtype

dict

returns

Response Syntax

{
    'NextMarker': 'string',
    'Aliases': [
        {
            'AliasArn': 'string',
            'Name': 'string',
            'FunctionVersion': 'string',
            'Description': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      A string, present if there are more aliases.

    • Aliases (list) --

      An list of alises.

      • (dict) --

        Provides configuration information about a Lambda function version alias.

        • AliasArn (string) --

          Lambda function ARN that is qualified using alias name as the suffix. For example, if you create an alias "BETA" pointing to a helloworld function version, the ARN is arn:aws:lambda:aws-regions:acct-id:function:helloworld:BETA .

        • Name (string) --

          Alias name.

        • FunctionVersion (string) --

          Function version to which the alias points.

        • Description (string) --

          Alias description.

AddPermission (updated) Link ¶
Changes (request)
{'Qualifier': 'string'}

Adds a permission to the resource policy associated with the specified AWS Lambda function. You use resource policies to grant permissions to event sources that use "push" model. In "push" model, event sources (such as Amazon S3 and custom applications) invoke your Lambda function. Each permission you add to the resource policy allows an event source, permission to invoke the Lambda function.

For information about the push model, see AWS Lambda: How it Works.

If you are using versioning feature (see AWS Lambda Function Versioning and Aliases ), a Lambda function can have multiple ARNs that can be used to invoke the function. Note that, each permission you add to resource policy using this API is specific to an ARN, specified using the Qualifier parameter

This operation requires permission for the lambda:AddPermission action.

Request Syntax

client.add_permission(
    FunctionName='string',
    StatementId='string',
    Action='string',
    Principal='string',
    SourceArn='string',
    SourceAccount='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

Name of the Lambda function whose resource policy you are updating by adding a new permission.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type StatementId

string

param StatementId

[REQUIRED]

A unique statement identifier.

type Action

string

param Action

[REQUIRED]

The AWS Lambda action you want to allow in this statement. Each Lambda action is a string starting with "lambda:" followed by the API name (see Operations ). For example, "lambda:CreateFunction". You can use wildcard ("lambda:*") to grant permission for all AWS Lambda actions.

type Principal

string

param Principal

[REQUIRED]

The principal who is getting this permission. It can be Amazon S3 service Principal ("s3.amazonaws.com") if you want Amazon S3 to invoke the function, an AWS account ID if you are granting cross-account permission, or any valid AWS service principal such as "sns.amazonaws.com". For example, you might want to allow a custom application in another AWS account to push events to AWS Lambda by invoking your function.

type SourceArn

string

param SourceArn

This is optional; however, when granting Amazon S3 permission to invoke your function, you should specify this field with the bucket Amazon Resource Name (ARN) as its value. This ensures that only events generated from the specified bucket can invoke the function.

Warning

If you add a permission for the Amazon S3 principal without providing the source ARN, any AWS account that creates a mapping to your function ARN can send events to invoke your Lambda function from Amazon S3.

type SourceAccount

string

param SourceAccount

The AWS account ID (without a hyphen) of the source owner. For example, if the SourceArn identifies a bucket, then this is the bucket owner's account ID. You can use this additional condition to ensure the bucket you specify is owned by a specific account (it is possible the bucket owner deleted the bucket and some other AWS account created the bucket). You can also use this condition to specify all sources (that is, you don't specify the SourceArn ) owned by a specific account.

type Qualifier

string

param Qualifier

You can specify this optional query parameter to specify function version or alias name. The permission will then apply to the specific qualified ARN. For example, if you specify function version 2 as the qualifier, then permission applies only when request is made using qualified function ARN:

arn:aws:lambda:aws-region:acct-id:function:function-name:2

If you specify alias name, for example "PROD", then the permission is valid only for requests made using the alias ARN:

arn:aws:lambda:aws-region:acct-id:function:function-name:PROD

If the qualifier is not specified, the permission is valid only when requests is made using unqualified function ARN.

arn:aws:lambda:aws-region:acct-id:function:function-name

rtype

dict

returns

Response Syntax

{
    'Statement': 'string'
}

Response Structure

  • (dict) --

    • Statement (string) --

      The permission statement you specified in the request. The response returns the same as a string using "" as an escape character in the JSON.

CreateFunction (updated) Link ¶
Changes (request, response)
Request
{'Publish': 'boolean', 'Runtime': {'python2.7'}}
Response
{'CodeSha256': 'string', 'Runtime': {'python2.7'}, 'Version': 'string'}

Creates a new Lambda function. The function metadata is created from the request parameters, and the code for the function is provided by a .zip file in the request body. If the function name already exists, the operation will fail. Note that the function name is case-sensitive.

This operation requires permission for the lambda:CreateFunction action.

Request Syntax

client.create_function(
    FunctionName='string',
    Runtime='nodejs'|'java8'|'python2.7',
    Role='string',
    Handler='string',
    Code={
        'ZipFile': b'bytes',
        'S3Bucket': 'string',
        'S3Key': 'string',
        'S3ObjectVersion': 'string'
    },
    Description='string',
    Timeout=123,
    MemorySize=123,
    Publish=True|False
)
type FunctionName

string

param FunctionName

[REQUIRED]

The name you want to assign to the function you are uploading. You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length. The function names appear in the console and are returned in the ListFunctions API. Function names are used to specify functions to other AWS Lambda APIs, such as Invoke.

type Runtime

string

param Runtime

[REQUIRED]

The runtime environment for the Lambda function you are uploading. Currently, Lambda supports "java" and "nodejs" as the runtime.

type Role

string

param Role

[REQUIRED]

The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources. For more information, see AWS Lambda: How it Works

type Handler

string

param Handler

[REQUIRED]

The function within your code that Lambda calls to begin execution. For Node.js, it is the module-name .*export* value in your function. For Java, it can be package.class-name::handler or package.class-name . For more information, see Lambda Function Handler (Java).

type Code

dict

param Code

[REQUIRED]

The code for the Lambda function.

  • ZipFile (bytes) --

    A base64-encoded .zip file containing your deployment package. For more information about creating a .zip file, go to Execution Permissions in the AWS Lambda Developer Guide .

  • S3Bucket (string) --

    Amazon S3 bucket name where the .zip file containing your deployment package is stored. This bucket must reside in the same AWS region where you are creating the Lambda function.

  • S3Key (string) --

    The Amazon S3 object (the deployment package) key name you want to upload.

  • S3ObjectVersion (string) --

    The Amazon S3 object (the deployment package) version you want to upload.

type Description

string

param Description

A short, user-defined function description. Lambda does not use this value. Assign a meaningful description as you see fit.

type Timeout

integer

param Timeout

The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

type MemorySize

integer

param MemorySize

The amount of memory, in MB, your Lambda function is given. Lambda uses this memory size to infer the amount of CPU and memory allocated to your function. Your function use-case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.

type Publish

boolean

param Publish

This boolean parameter can be used to request AWS Lambda to create the Lambda function and publish a version as an atomic operation.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

DeleteFunction (updated) Link ¶
Changes (request)
{'Qualifier': 'string'}

Deletes the specified Lambda function code and configuration.

If you don't specify a function version, AWS Lambda will delete the function, including all its versions, and any aliases pointing to the function versions.

When you delete a function the associated resource policy is also deleted. You will need to delete the event source mappings explicitly.

For information about function versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:DeleteFunction action.

Request Syntax

client.delete_function(
    FunctionName='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function to delete.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Qualifier

string

param Qualifier

Using this optional parameter you can specify a function version (but not the $LATEST version) to direct AWS Lambda to delete a specific function version. If the function version has one or more aliases pointing to it, you will get an error because you cannot have aliases pointing to it. You can delete any function version but not the $LATEST, that is, you cannot specify $LATEST as the value of this parameter. The $LATEST version can be deleted only when you want to delete all the function versions and aliases.

You can only specify a function version and not alias name using this parameter. You cannot delete a function version using its alias.

If you don't specify this parameter, AWS Lambda will delete the function, including all its versions and aliases.

returns

None

GetFunction (updated) Link ¶
Changes (request, response)
Request
{'Qualifier': 'string'}
Response
{'Configuration': {'CodeSha256': 'string',
                   'Runtime': {'python2.7'},
                   'Version': 'string'}}

Returns the configuration information of the Lambda function and a presigned URL link to the .zip file you uploaded with CreateFunction so you can download the .zip file. Note that the URL is valid for up to 10 minutes. The configuration information is the same information you provided as parameters when uploading the function.

Using the optional Qualifier parameter, you can specify a specific function version for which you want this information. If you don't specify this parameter, the API uses unqualified function ARN which return information about the $LATEST version of the Lambda function. For more information, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunction action.

Request Syntax

client.get_function(
    FunctionName='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function name.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Qualifier

string

param Qualifier

Using this optional parameter to specify a function version or alias name. If you specify function version, the API uses qualified function ARN for the request and returns information about the specific Lambda function version. If you specify alias name, the API uses alias ARN and returns information about the function version to which the alias points. If you don't provide this parameter, the API uses unqualified function ARN and returns information about the $LATEST version of the Lambda function.

rtype

dict

returns

Response Syntax

{
    'Configuration': {
        'FunctionName': 'string',
        'FunctionArn': 'string',
        'Runtime': 'nodejs'|'java8'|'python2.7',
        'Role': 'string',
        'Handler': 'string',
        'CodeSize': 123,
        'Description': 'string',
        'Timeout': 123,
        'MemorySize': 123,
        'LastModified': 'string',
        'CodeSha256': 'string',
        'Version': 'string'
    },
    'Code': {
        'RepositoryType': 'string',
        'Location': 'string'
    }
}

Response Structure

  • (dict) --

    This response contains the object for the Lambda function location (see API_FunctionCodeLocation

    • Configuration (dict) --

      A complex type that describes function metadata.

      • FunctionName (string) --

        The name of the function.

      • FunctionArn (string) --

        The Amazon Resource Name (ARN) assigned to the function.

      • Runtime (string) --

        The runtime environment for the Lambda function.

      • Role (string) --

        The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

      • Handler (string) --

        The function Lambda calls to begin executing your function.

      • CodeSize (integer) --

        The size, in bytes, of the function .zip file you uploaded.

      • Description (string) --

        The user-provided description.

      • Timeout (integer) --

        The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

      • MemorySize (integer) --

        The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

      • LastModified (string) --

        The timestamp of the last time you updated the function.

      • CodeSha256 (string) --

        It is the SHA256 hash of your function deployment package.

      • Version (string) --

        The version of the Lambda function.

    • Code (dict) --

      The object for the Lambda function location.

      • RepositoryType (string) --

        The repository from which you can download the function.

      • Location (string) --

        The presigned URL you can use to download the function's .zip file that you previously uploaded. The URL is valid for up to 10 minutes.

GetFunctionConfiguration (updated) Link ¶
Changes (request, response)
Request
{'Qualifier': 'string'}
Response
{'CodeSha256': 'string', 'Runtime': {'python2.7'}, 'Version': 'string'}

Returns the configuration information of the Lambda function. This the same information you provided as parameters when uploading the function by using CreateFunction.

You can use the optional Qualifier parameter to retrieve configuration information for a specific Lambda function version. If you don't provide it, the API returns information about the $LATEST version of the function. For more information about versioning, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:GetFunctionConfiguration operation.

Request Syntax

client.get_function_configuration(
    FunctionName='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The name of the Lambda function for which you want to retrieve the configuration information.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Qualifier

string

param Qualifier

Using this optional parameter you can specify function version or alias name. If you specify function version, the API uses qualified function ARN and returns information about the specific function version. if you specify alias name, the API uses alias ARN and returns information about the function version to which the alias points.

If you don't specify this parameter, the API uses unqualified function ARN, and returns information about the $LATEST function version.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

GetPolicy (updated) Link ¶
Changes (request)
{'Qualifier': 'string'}

Returns the resource policy, containing a list of permissions that apply to a specific to an ARN that you specify via the Qualifier paramter.

For informration about adding permissions, see AddPermission.

You need permission for the lambda:GetPolicy action.

Request Syntax

client.get_policy(
    FunctionName='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

Function name whose resource policy you want to retrieve.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Qualifier

string

param Qualifier

You can specify this optional query parameter to specify function version or alias name in which case this API will return all permissions associated with the specific ARN. If you don't provide this parameter, the API will return permissions that apply to the unqualified function ARN.

rtype

dict

returns

Response Syntax

{
    'Policy': 'string'
}

Response Structure

  • (dict) --

    • Policy (string) --

      The resource policy associated with the specified function. The response returns the same as a string using "" as an escape character in the JSON.

Invoke (updated) Link ¶
Changes (request)
{'Qualifier': 'string'}

Invokes a specific Lambda function version.

If you don't provide the Qualifier parameter, it uses the unqualified function ARN which results in invocation of the $LATEST version of the Lambda function (when you create a Lambda function, the $LATEST is the version). The AWS Lambda versioning and aliases feature allows you to publish multiple versions of a Lambda function and also create aliases for each function version. So each your Lambda function version can be invoked using multiple ARNs. For more information, see AWS Lambda Function Versioning and Aliases. Using the Qualifier parameter, you can specify a function version or alias name to invoke specific function version. If you specify function version, the API uses the qualified function ARN to invoke a specific function version. If you specify alias name, the API uses the alias ARN to invoke the function version to which the alias points.

This operation requires permission for the lambda:InvokeFunction action.

Request Syntax

client.invoke(
    FunctionName='string',
    InvocationType='Event'|'RequestResponse'|'DryRun',
    LogType='None'|'Tail',
    ClientContext='string',
    Payload=b'bytes'|file,
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function name.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type InvocationType

string

param InvocationType

By default, the Invoke API assumes "RequestResponse" invocation type. You can optionally request asynchronous execution by specifying "Event" as the InvocationType . You can also use this parameter to request AWS Lambda to not execute the function but do some verification, such as if the caller is authorized to invoke the function and if the inputs are valid. You request this by specifying "DryRun" as the InvocationType . This is useful in a cross-account scenario when you want to verify access to a function without running it.

type LogType

string

param LogType

You can set this optional parameter to "Tail" in the request only if you specify the InvocationType parameter with value "RequestResponse". In this case, AWS Lambda returns the base64-encoded last 4 KB of log data produced by your Lambda function in the x-amz-log-results header.

type ClientContext

string

param ClientContext

Using the ClientContext you can pass client-specific information to the Lambda function you are invoking. You can then process the client information in your Lambda function as you choose through the context variable. For an example of a ClientContext JSON, go to PutEvents in the Amazon Mobile Analytics API Reference and User Guide .

The ClientContext JSON must be base64-encoded.

type Payload

bytes or seekable file-like object

param Payload

JSON that you want to provide to your Lambda function as input.

type Qualifier

string

param Qualifier

You can use this optional paramter to specify a Lambda function version or alias name. If you specify function version, the API uses qualified function ARN to invoke a specific Lambda function. If you specify alias name, the API uses the alias ARN to invoke the Lambda function version to which the alias points.

If you don't provide this parameter, then the API uses unqualified function ARN which results in invocation of the $LATEST version.

rtype

dict

returns

Response Syntax

{
    'StatusCode': 123,
    'FunctionError': 'string',
    'LogResult': 'string',
    'Payload': b'bytes'|file
}

Response Structure

  • (dict) --

    Upon success, returns an empty response. Otherwise, throws an exception.

    • StatusCode (integer) --

      The HTTP status code will be in the 200 range for successful request. For the "RequestResonse" invocation type this status code will be 200. For the "Event" invocation type this status code will be 202. For the "DryRun" invocation type the status code will be 204.

    • FunctionError (string) --

      Indicates whether an error occurred while executing the Lambda function. If an error occurred this field will have one of two values; Handled or Unhandled . Handled errors are errors that are reported by the function while the Unhandled errors are those detected and reported by AWS Lambda. Unhandled errors include out of memory errors and function timeouts. For information about how to report an Handled error, see Programming Model.

    • LogResult (string) --

      It is the base64-encoded logs for the Lambda function invocation. This is present only if the invocation type is "RequestResponse" and the logs were requested.

    • Payload (bytes or seekable file-like object) --

      It is the JSON representation of the object returned by the Lambda function. In This is present only if the invocation type is "RequestResponse".

      In the event of a function error this field contains a message describing the error. For the Handled errors the Lambda function will report this message. For Unhandled errors AWS Lambda reports the message.

ListFunctions (updated) Link ¶
Changes (response)
{'Functions': {'CodeSha256': 'string',
               'Runtime': {'python2.7'},
               'Version': 'string'}}

Returns a list of your Lambda functions. For each function, the response includes the function configuration information. You must use GetFunction to retrieve the code for your function.

This operation requires permission for the lambda:ListFunctions action.

Request Syntax

client.list_functions(
    Marker='string',
    MaxItems=123
)
type Marker

string

param Marker

Optional string. An opaque pagination token returned from a previous ListFunctions operation. If present, indicates where to continue the listing.

type MaxItems

integer

param MaxItems

Optional integer. Specifies the maximum number of AWS Lambda functions to return in response. This parameter value must be greater than 0.

rtype

dict

returns

Response Syntax

{
    'NextMarker': 'string',
    'Functions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'java8'|'python2.7',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Contains a list of AWS Lambda function configurations (see FunctionConfiguration.

    • NextMarker (string) --

      A string, present if there are more functions.

    • Functions (list) --

      A list of Lambda functions.

      • (dict) --

        A complex type that describes function metadata.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) assigned to the function.

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

        • Handler (string) --

          The function Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size, in bytes, of the function .zip file you uploaded.

        • Description (string) --

          The user-provided description.

        • Timeout (integer) --

          The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

        • MemorySize (integer) --

          The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

        • LastModified (string) --

          The timestamp of the last time you updated the function.

        • CodeSha256 (string) --

          It is the SHA256 hash of your function deployment package.

        • Version (string) --

          The version of the Lambda function.

PublishVersion (updated) Link ¶
Changes (response)
{'CodeSha256': 'string', 'Runtime': {'python2.7'}, 'Version': 'string'}

Publishes a version of your function from the current snapshot of HEAD. That is, AWS Lambda takes a snapshot of the function code and configuration information from HEAD and publishes a new version. The code and handler of this specific Lambda function version cannot be modified after publication, but you can modify the configuration information.

Request Syntax

client.publish_version(
    FunctionName='string',
    CodeSha256='string',
    Description='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

The Lambda function name. You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type CodeSha256

string

param CodeSha256

The SHA256 hash of the deployment package you want to publish. This provides validation on the code you are publishing. If you provide this parameter value must match the SHA256 of the HEAD version for the publication to succeed.

type Description

string

param Description

The description for the version you are publishing. If not provided, AWS Lambda copies the description from the HEAD version.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

RemovePermission (updated) Link ¶
Changes (request)
{'Qualifier': 'string'}

You can remove individual permissions from an resource policy associated with a Lambda function by providing a statement ID that you provided when you addded the permission. The API removes corresponding permission that is associated with the specific ARN identified by the Qualifier parameter.

Note that removal of a permission will cause an active event source to lose permission to the function.

You need permission for the lambda:RemovePermission action.

Request Syntax

client.remove_permission(
    FunctionName='string',
    StatementId='string',
    Qualifier='string'
)
type FunctionName

string

param FunctionName

[REQUIRED]

Lambda function whose resource policy you want to remove a permission from.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type StatementId

string

param StatementId

[REQUIRED]

Statement ID of the permission to remove.

type Qualifier

string

param Qualifier

You can specify this optional parameter to remove permission associated with a specific function version or function alias. The value of this paramter is the function version or alias name. If you don't specify this parameter, the API removes permission associated with the unqualified function ARN.

returns

None

UpdateFunctionCode (updated) Link ¶
Changes (request, response)
Request
{'Publish': 'boolean'}
Response
{'CodeSha256': 'string', 'Runtime': {'python2.7'}, 'Version': 'string'}

Updates the code for the specified Lambda function. This operation must only be used on an existing Lambda function and cannot be used to update the function configuration.

This operation requires permission for the lambda:UpdateFunctionCode action.

Request Syntax

client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string',
    Publish=True|False
)
type FunctionName

string

param FunctionName

[REQUIRED]

The existing Lambda function name whose code you want to replace.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type ZipFile

bytes

param ZipFile

Based64-encoded .zip file containing your packaged source code.

type S3Bucket

string

param S3Bucket

Amazon S3 bucket name where the .zip file containing your deployment package is stored. This bucket must reside in the same AWS region where you are creating the Lambda function.

type S3Key

string

param S3Key

The Amazon S3 object (the deployment package) key name you want to upload.

type S3ObjectVersion

string

param S3ObjectVersion

The Amazon S3 object (the deployment package) version you want to upload.

type Publish

boolean

param Publish

This boolean parameter can be used to request AWS Lambda to update the Lambda function and publish a version as an atomic operation.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

UpdateFunctionConfiguration (updated) Link ¶
Changes (response)
{'CodeSha256': 'string', 'Runtime': {'python2.7'}, 'Version': 'string'}

Updates the configuration parameters for the specified Lambda function by using the values provided in the request. You provide only the parameters you want to change. This operation must only be used on an existing Lambda function and cannot be used to update the function's code.

This operation requires permission for the lambda:UpdateFunctionConfiguration action.

Request Syntax

client.update_function_configuration(
    FunctionName='string',
    Role='string',
    Handler='string',
    Description='string',
    Timeout=123,
    MemorySize=123
)
type FunctionName

string

param FunctionName

[REQUIRED]

The name of the Lambda function.

You can specify an unqualified function name (for example, "Thumbnail") or you can specify Amazon Resource Name (ARN) of the function (for example, "arn:aws:lambda:us-west-2:account-id:function:ThumbNail"). AWS Lambda also allows you to specify only the account ID qualifier (for example, "account-id:Thumbnail"). Note that the length constraint applies only to the ARN. If you specify only the function name, it is limited to 64 character in length.

type Role

string

param Role

The Amazon Resource Name (ARN) of the IAM role that Lambda will assume when it executes your function.

type Handler

string

param Handler

The function that Lambda calls to begin executing your function. For Node.js, it is the module-name.export value in your function.

type Description

string

param Description

A short user-defined function description. AWS Lambda does not use this value. Assign a meaningful description as you see fit.

type Timeout

integer

param Timeout

The function execution time at which AWS Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

type MemorySize

integer

param MemorySize

The amount of memory, in MB, your Lambda function is given. AWS Lambda uses this memory size to infer the amount of CPU allocated to your function. Your function use-case determines your CPU and memory requirements. For example, a database operation might need less memory compared to an image processing function. The default value is 128 MB. The value must be a multiple of 64 MB.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'java8'|'python2.7',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) assigned to the function.

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web Services (AWS) resources.

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size, in bytes, of the function .zip file you uploaded.

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

      The function execution time at which Lambda should terminate the function. Because the execution time has cost implications, we recommend you set this value based on your expected execution time. The default is 3 seconds.

    • MemorySize (integer) --

      The memory size, in MB, you configured for the function. Must be a multiple of 64 MB.

    • LastModified (string) --

      The timestamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.