Lambda

Table of Contents

Client

class Lambda.Client

A low-level client representing AWS Lambda:

import boto3

client = boto3.client('lambda')

These are the available methods:

add_layer_version_permission(**kwargs)

Adds permissions to the resource-based policy of a version of an AWS Lambda layer . Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all AWS accounts, or all accounts in an organization.

To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you added it.

See also: AWS API Documentation

Request Syntax

response = client.add_layer_version_permission(
    LayerName='string',
    VersionNumber=123,
    StatementId='string',
    Action='string',
    Principal='string',
    OrganizationId='string',
    RevisionId='string'
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • VersionNumber (integer) --

    [REQUIRED]

    The version number.

  • StatementId (string) --

    [REQUIRED]

    An identifier that distinguishes the policy from others on the same layer version.

  • Action (string) --

    [REQUIRED]

    The API action that grants access to the layer. For example, lambda:GetLayerVersion .

  • Principal (string) --

    [REQUIRED]

    An account ID, or * to grant permission to all AWS accounts.

  • OrganizationId (string) -- With the principal set to * , grant permission to all accounts in the specified organization.
  • RevisionId (string) -- Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.
Return type

dict

Returns

Response Syntax

{
    'Statement': 'string',
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    • Statement (string) --

      The permission statement.

    • RevisionId (string) --

      A unique identifier for the current revision of the policy.

add_permission(**kwargs)

Grants an AWS service or another account permission to use a function. You can apply the policy at the function level, or specify a qualifier to restrict access to a single version or alias. If you use a qualifier, the invoker must use the full Amazon Resource Name (ARN) of that version or alias to invoke the function.

To grant permission to another account, specify the account ID as the Principal . For AWS services, the principal is a domain-style identifier defined by the service, like s3.amazonaws.com or sns.amazonaws.com . For AWS services, you can also specify the ARN or owning account of the associated resource as the SourceArn or SourceAccount . If you grant permission to a service principal without specifying the source, other accounts could potentially configure resources in their account to invoke your Lambda function.

This action adds a statement to a resource-based permission policy for the function. For more information about function policies, see Lambda Function Policies .

See also: AWS API Documentation

Request Syntax

response = client.add_permission(
    FunctionName='string',
    StatementId='string',
    Action='string',
    Principal='string',
    SourceArn='string',
    SourceAccount='string',
    EventSourceToken='string',
    Qualifier='string',
    RevisionId='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • StatementId (string) --

    [REQUIRED]

    A statement identifier that differentiates the statement from others in the same policy.

  • Action (string) --

    [REQUIRED]

    The action that the principal can use on the function. For example, lambda:InvokeFunction or lambda:GetFunction .

  • Principal (string) --

    [REQUIRED]

    The AWS service or account that invokes the function. If you specify a service, use SourceArn or SourceAccount to limit who can invoke the function through that service.

  • SourceArn (string) -- For AWS services, the ARN of the AWS resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.
  • SourceAccount (string) -- For AWS services, the ID of the account that owns the resource. Use this instead of SourceArn to grant permission to resources that are owned by another account (for example, all of an account's Amazon S3 buckets). Or use it together with SourceArn to ensure that the resource is owned by the specified account. For example, an Amazon S3 bucket could be deleted by its owner and recreated by another account.
  • EventSourceToken (string) -- For Alexa Smart Home functions, a token that must be supplied by the invoker.
  • Qualifier (string) -- Specify a version or alias to add permissions to a published version of the function.
  • RevisionId (string) -- Only update the policy if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.
Return type

dict

Returns

Response Syntax

{
    'Statement': 'string'
}

Response Structure

  • (dict) --

    • Statement (string) --

      The permission statement that's added to the function policy.

Examples

This example adds a permission for an S3 bucket to invoke a Lambda function.

response = client.add_permission(
    Action='lambda:InvokeFunction',
    FunctionName='MyFunction',
    Principal='s3.amazonaws.com',
    SourceAccount='123456789012',
    SourceArn='arn:aws:s3:::examplebucket/*',
    StatementId='ID-1',
)

print(response)

Expected Output:

{
    'Statement': 'ID-1',
    'ResponseMetadata': {
        '...': '...',
    },
}
can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
create_alias(**kwargs)

Creates an alias for a Lambda function version. Use aliases to provide clients with a function identifier that you can update to invoke a different version.

You can also map an alias to split invocation requests between two versions. Use the RoutingConfig parameter to specify a second version and the percentage of invocation requests that it receives.

See also: AWS API Documentation

Request Syntax

response = client.create_alias(
    FunctionName='string',
    Name='string',
    FunctionVersion='string',
    Description='string',
    RoutingConfig={
        'AdditionalVersionWeights': {
            'string': 123.0
        }
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Name (string) --

    [REQUIRED]

    The name of the alias.

  • FunctionVersion (string) --

    [REQUIRED]

    The function version that the alias invokes.

  • Description (string) -- A description of the alias.
  • RoutingConfig (dict) --

    The routing configuration of the alias.

    • AdditionalVersionWeights (dict) --

      The name of the second alias, and the percentage of traffic that's routed to it.

      • (string) --
        • (float) --
Return type

dict

Returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string',
    'RoutingConfig': {
        'AdditionalVersionWeights': {
            'string': 123.0
        }
    },
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function alias .

    • AliasArn (string) --

      The Amazon Resource Name (ARN) of the alias.

    • Name (string) --

      The name of the alias.

    • FunctionVersion (string) --

      The function version that the alias invokes.

    • Description (string) --

      A description of the alias.

    • RoutingConfig (dict) --

      The routing configuration of the alias.

      • AdditionalVersionWeights (dict) --

        The name of the second alias, and the percentage of traffic that's routed to it.

        • (string) --
          • (float) --
    • RevisionId (string) --

      A unique identifier that changes when you update the alias.

create_event_source_mapping(**kwargs)

Creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source and triggers the function.

For details about each event source type, see the following topics.

See also: AWS API Documentation

Request Syntax

response = client.create_event_source_mapping(
    EventSourceArn='string',
    FunctionName='string',
    Enabled=True|False,
    BatchSize=123,
    StartingPosition='TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    StartingPositionTimestamp=datetime(2015, 1, 1)
)
Parameters
  • EventSourceArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the event source.

    • Amazon Kinesis - The ARN of the data stream or a stream consumer.
    • Amazon DynamoDB Streams - The ARN of the stream.
    • Amazon Simple Queue Service - The ARN of the queue.
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

  • Enabled (boolean) -- Disables the event source mapping to pause polling and invocation.
  • BatchSize (integer) --

    The maximum number of items to retrieve in a single batch.

    • Amazon Kinesis - Default 100. Max 10,000.
    • Amazon DynamoDB Streams - Default 100. Max 1,000.
    • Amazon Simple Queue Service - Default 10. Max 10.
  • StartingPosition (string) -- The position in a stream from which to start reading. Required for Amazon Kinesis and Amazon DynamoDB Streams sources. AT_TIMESTAMP is only supported for Amazon Kinesis streams.
  • StartingPositionTimestamp (datetime) -- With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.
Return type

dict

Returns

Response Syntax

{
    'UUID': 'string',
    'BatchSize': 123,
    'EventSourceArn': 'string',
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string'
}

Response Structure

  • (dict) --

    A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

    • UUID (string) --

      The identifier of the event source mapping.

    • BatchSize (integer) --

      The maximum number of items to retrieve in a single batch.

    • EventSourceArn (string) --

      The Amazon Resource Name (ARN) of the event source.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated.

    • LastProcessingResult (string) --

      The result of the last AWS Lambda invocation of your Lambda function.

    • State (string) --

      The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

    • StateTransitionReason (string) --

      The cause of the last state change, either User initiated or Lambda initiated .

create_function(**kwargs)

Creates a Lambda function. To create a function, you need a deployment package and an execution role . The deployment package contains your function code. The execution role grants the function permission to use AWS services, such as Amazon CloudWatch Logs for log streaming and AWS X-Ray for request tracing.

A function has an unpublished version, and can have published versions and aliases. The unpublished version changes when you update your function's code and configuration. A published version is a snapshot of your function code and configuration that can't be changed. An alias is a named resource that maps to a version, and can be changed to map to a different version. Use the Publish parameter to create version 1 of your function from its initial configuration.

The other parameters let you configure version-specific and function-level settings. You can modify version-specific settings later with UpdateFunctionConfiguration . Function-level settings apply to both the unpublished and published versions of the function, and include tags ( TagResource ) and per-function concurrency limits ( PutFunctionConcurrency ).

If another account or an AWS service invokes your function, use AddPermission to grant permission by creating a resource-based IAM policy. You can grant permissions at the function level, on a version, or on an alias.

To invoke your function directly, use Invoke . To invoke your function in response to events in other AWS services, create an event source mapping ( CreateEventSourceMapping ), or configure a function trigger in the other service. For more information, see Invoking Functions .

See also: AWS API Documentation

Request Syntax

response = client.create_function(
    FunctionName='string',
    Runtime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    Role='string',
    Handler='string',
    Code={
        'ZipFile': b'bytes',
        'S3Bucket': 'string',
        'S3Key': 'string',
        'S3ObjectVersion': 'string'
    },
    Description='string',
    Timeout=123,
    MemorySize=123,
    Publish=True|False,
    VpcConfig={
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ]
    },
    DeadLetterConfig={
        'TargetArn': 'string'
    },
    Environment={
        'Variables': {
            'string': 'string'
        }
    },
    KMSKeyArn='string',
    TracingConfig={
        'Mode': 'Active'|'PassThrough'
    },
    Tags={
        'string': 'string'
    },
    Layers=[
        'string',
    ]
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - my-function .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Runtime (string) --

    [REQUIRED]

    The identifier of the function's runtime .

  • Role (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) of the function's execution role.

  • Handler (string) --

    [REQUIRED]

    The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Programming Model .

  • Code (dict) --

    [REQUIRED]

    The code for the function.

    • ZipFile (bytes) --

      The base64-encoded contents of the deployment package. AWS SDK and AWS CLI clients handle the encoding for you.

    • S3Bucket (string) --

      An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.

    • S3Key (string) --

      The Amazon S3 key of the deployment package.

    • S3ObjectVersion (string) --

      For versioned objects, the version of the deployment package object to use.

  • Description (string) -- A description of the function.
  • Timeout (integer) -- The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.
  • MemorySize (integer) -- The amount of memory that your function has access to. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.
  • Publish (boolean) -- Set to true to publish the first version of the function during creation.
  • VpcConfig (dict) --

    For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can only access resources and the internet through that VPC. For more information, see VPC Settings .

    • SubnetIds (list) --

      A list of VPC subnet IDs.

      • (string) --
    • SecurityGroupIds (list) --

      A list of VPC security groups IDs.

      • (string) --
  • DeadLetterConfig (dict) --

    A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues .

    • TargetArn (string) --

      The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

  • Environment (dict) --

    Environment variables that are accessible from function code during execution.

    • Variables (dict) --

      Environment variable key-value pairs.

      • (string) --
        • (string) --
  • KMSKeyArn (string) -- The ARN of the AWS Key Management Service (AWS KMS) key that's used to encrypt your function's environment variables. If it's not provided, AWS Lambda uses a default service key.
  • TracingConfig (dict) --

    Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

    • Mode (string) --

      The tracing mode.

  • Tags (dict) --

    A list of tags to apply to the function.

    • (string) --
      • (string) --
  • Layers (list) --

    A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string',
    'VpcConfig': {
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ],
        'VpcId': 'string'
    },
    'DeadLetterConfig': {
        'TargetArn': 'string'
    },
    'Environment': {
        'Variables': {
            'string': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'KMSKeyArn': 'string',
    'TracingConfig': {
        'Mode': 'Active'|'PassThrough'
    },
    'MasterArn': 'string',
    'RevisionId': 'string',
    'Layers': [
        {
            'Arn': 'string',
            'CodeSize': 123
        },
    ]
}

Response Structure

  • (dict) --

    Details about a function's configuration.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The function's Amazon Resource Name (ARN).

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The function's execution role.

    • Handler (string) --

      The function that Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size of the function's deployment package, in bytes.

    • Description (string) --

      The function's description.

    • Timeout (integer) --

      The amount of time that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The memory that's allocated to the function.

    • LastModified (string) --

      The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • CodeSha256 (string) --

      The SHA256 hash of the function's deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      The function's networking configuration.

      • SubnetIds (list) --

        A list of VPC subnet IDs.

        • (string) --
      • SecurityGroupIds (list) --

        A list of VPC security groups IDs.

        • (string) --
      • VpcId (string) --

        The ID of the VPC.

    • DeadLetterConfig (dict) --

      The function's dead letter queue.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment (dict) --

      The function's environment variables.

      • Variables (dict) --

        Environment variable key-value pairs.

        • (string) --
          • (string) --
      • Error (dict) --

        Error messages for environment variables that couldn't be applied.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

    • KMSKeyArn (string) --

      The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

    • TracingConfig (dict) --

      The function's AWS X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

      For Lambda@Edge functions, the ARN of the master function.

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers .

      • (dict) --

        An AWS Lambda layer .

        • Arn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize (integer) --

          The size of the layer archive in bytes.

Examples

This example creates a Lambda function.

response = client.create_function(
    Code={
    },
    Description='',
    FunctionName='MyFunction',
    # is of the form of the name of your source file and then name of your function handler
    Handler='souce_file.handler_name',
    MemorySize=128,
    Publish=True,
    # replace with the actual arn of the execution role you created
    Role='arn:aws:iam::123456789012:role/service-role/role-name',
    Runtime='nodejs4.3',
    Timeout=15,
    VpcConfig={
    },
)

print(response)

Expected Output:

{
    'CodeSha256': '',
    'CodeSize': 123,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:MyFunction',
    'FunctionName': 'MyFunction',
    'Handler': 'source_file.handler_name',
    'LastModified': '2016-11-21T19:49:20.006+0000',
    'MemorySize': 128,
    'Role': 'arn:aws:iam::123456789012:role/service-role/role-name',
    'Runtime': 'nodejs4.3',
    'Timeout': 123,
    'Version': '1',
    'VpcConfig': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
delete_alias(**kwargs)

Deletes a Lambda function alias .

See also: AWS API Documentation

Request Syntax

response = client.delete_alias(
    FunctionName='string',
    Name='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Name (string) --

    [REQUIRED]

    The name of the alias.

Returns

None

Examples

This operation deletes a Lambda function alias

response = client.delete_alias(
    FunctionName='myFunction',
    Name='alias',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
delete_event_source_mapping(**kwargs)

Deletes an event source mapping . You can get the identifier of a mapping from the output of ListEventSourceMappings .

See also: AWS API Documentation

Request Syntax

response = client.delete_event_source_mapping(
    UUID='string'
)
Parameters
UUID (string) --

[REQUIRED]

The identifier of the event source mapping.

Return type
dict
Returns
Response Syntax
{
    'UUID': 'string',
    'BatchSize': 123,
    'EventSourceArn': 'string',
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string'
}

Response Structure

  • (dict) --

    A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

    • UUID (string) --

      The identifier of the event source mapping.

    • BatchSize (integer) --

      The maximum number of items to retrieve in a single batch.

    • EventSourceArn (string) --

      The Amazon Resource Name (ARN) of the event source.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated.

    • LastProcessingResult (string) --

      The result of the last AWS Lambda invocation of your Lambda function.

    • State (string) --

      The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

    • StateTransitionReason (string) --

      The cause of the last state change, either User initiated or Lambda initiated .

Examples

This operation deletes a Lambda function event source mapping

response = client.delete_event_source_mapping(
    UUID='12345kxodurf3443',
)

print(response)

Expected Output:

{
    'BatchSize': 123,
    'EventSourceArn': 'arn:aws:s3:::examplebucket/*',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'LastProcessingResult': '',
    'State': '',
    'StateTransitionReason': '',
    'UUID': '12345kxodurf3443',
    'ResponseMetadata': {
        '...': '...',
    },
}
delete_function(**kwargs)

Deletes a Lambda function. To delete a specific function version, use the Qualifier parameter. Otherwise, all versions and aliases are deleted.

To delete Lambda event source mappings that invoke a function, use DeleteEventSourceMapping . For AWS services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.

See also: AWS API Documentation

Request Syntax

response = client.delete_function(
    FunctionName='string',
    Qualifier='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function or version.

    Name formats
    • Function name - my-function (name-only), my-function:1 (with version).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Qualifier (string) -- Specify a version to delete. You can't delete a version that's referenced by an alias.
Returns

None

Examples

This operation deletes a Lambda function

response = client.delete_function(
    FunctionName='myFunction',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
delete_function_concurrency(**kwargs)

Removes a concurrent execution limit from a function.

See also: AWS API Documentation

Request Syntax

response = client.delete_function_concurrency(
    FunctionName='string'
)
Parameters
FunctionName (string) --

[REQUIRED]

The name of the Lambda function.

Name formats
  • Function name - my-function .
  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
  • Partial ARN - 123456789012:function:my-function .

The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Returns
None
delete_layer_version(**kwargs)

Deletes a version of an AWS Lambda layer . Deleted versions can no longer be viewed or added to functions. To avoid breaking functions, a copy of the version remains in Lambda until no functions refer to it.

See also: AWS API Documentation

Request Syntax

response = client.delete_layer_version(
    LayerName='string',
    VersionNumber=123
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • VersionNumber (integer) --

    [REQUIRED]

    The version number.

Returns

None

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_account_settings()

Retrieves details about your account's limits and usage in an AWS Region.

See also: AWS API Documentation

Request Syntax

response = client.get_account_settings()
Return type
dict
Returns
Response Syntax
{
    'AccountLimit': {
        'TotalCodeSize': 123,
        'CodeSizeUnzipped': 123,
        'CodeSizeZipped': 123,
        'ConcurrentExecutions': 123,
        'UnreservedConcurrentExecutions': 123
    },
    'AccountUsage': {
        'TotalCodeSize': 123,
        'FunctionCount': 123
    }
}

Response Structure

  • (dict) --
    • AccountLimit (dict) --

      Limits that are related to concurrency and code storage.

      • TotalCodeSize (integer) --

        The amount of storage space that you can use for all deployment packages and layer archives.

      • CodeSizeUnzipped (integer) --

        The maximum size of your function's code and layers when they're extracted.

      • CodeSizeZipped (integer) --

        The maximum size of a deployment package when it's uploaded directly to AWS Lambda. Use Amazon S3 for larger files.

      • ConcurrentExecutions (integer) --

        The maximum number of simultaneous function executions.

      • UnreservedConcurrentExecutions (integer) --

        The maximum number of simultaneous function executions, minus the capacity that's reserved for individual functions with PutFunctionConcurrency .

    • AccountUsage (dict) --

      The number of functions and amount of storage in use.

      • TotalCodeSize (integer) --

        The amount of storage space, in bytes, that's being used by deployment packages and layer archives.

      • FunctionCount (integer) --

        The number of Lambda functions.

Examples

This operation retrieves a Lambda customer's account settings

response = client.get_account_settings(
)

print(response)

Expected Output:

{
    'AccountLimit': {
    },
    'AccountUsage': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
get_alias(**kwargs)

Returns details about a Lambda function alias .

See also: AWS API Documentation

Request Syntax

response = client.get_alias(
    FunctionName='string',
    Name='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Name (string) --

    [REQUIRED]

    The name of the alias.

Return type

dict

Returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string',
    'RoutingConfig': {
        'AdditionalVersionWeights': {
            'string': 123.0
        }
    },
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function alias .

    • AliasArn (string) --

      The Amazon Resource Name (ARN) of the alias.

    • Name (string) --

      The name of the alias.

    • FunctionVersion (string) --

      The function version that the alias invokes.

    • Description (string) --

      A description of the alias.

    • RoutingConfig (dict) --

      The routing configuration of the alias.

      • AdditionalVersionWeights (dict) --

        The name of the second alias, and the percentage of traffic that's routed to it.

        • (string) --
          • (float) --
    • RevisionId (string) --

      A unique identifier that changes when you update the alias.

Examples

This operation retrieves a Lambda function alias

response = client.get_alias(
    FunctionName='myFunction',
    Name='myFunctionAlias',
)

print(response)

Expected Output:

{
    'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunctionAlias',
    'Description': '',
    'FunctionVersion': '1',
    'Name': 'myFunctionAlias',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_event_source_mapping(**kwargs)

Returns details about an event source mapping. You can get the identifier of a mapping from the output of ListEventSourceMappings .

See also: AWS API Documentation

Request Syntax

response = client.get_event_source_mapping(
    UUID='string'
)
Parameters
UUID (string) --

[REQUIRED]

The identifier of the event source mapping.

Return type
dict
Returns
Response Syntax
{
    'UUID': 'string',
    'BatchSize': 123,
    'EventSourceArn': 'string',
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string'
}

Response Structure

  • (dict) --

    A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

    • UUID (string) --

      The identifier of the event source mapping.

    • BatchSize (integer) --

      The maximum number of items to retrieve in a single batch.

    • EventSourceArn (string) --

      The Amazon Resource Name (ARN) of the event source.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated.

    • LastProcessingResult (string) --

      The result of the last AWS Lambda invocation of your Lambda function.

    • State (string) --

      The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

    • StateTransitionReason (string) --

      The cause of the last state change, either User initiated or Lambda initiated .

Examples

This operation retrieves a Lambda function's event source mapping

response = client.get_event_source_mapping(
    UUID='123489-xxxxx-kdla8d89d7',
)

print(response)

Expected Output:

{
    'BatchSize': 123,
    'EventSourceArn': 'arn:aws:iam::123456789012:eventsource',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'LastProcessingResult': '',
    'State': '',
    'StateTransitionReason': '',
    'UUID': '123489-xxxxx-kdla8d89d7',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_function(**kwargs)

Returns information about the function or function version, with a link to download the deployment package that's valid for 10 minutes. If you specify a function version, only details that are specific to that version are returned.

See also: AWS API Documentation

Request Syntax

response = client.get_function(
    FunctionName='string',
    Qualifier='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Qualifier (string) -- Specify a version or alias to get details about a published version of the function.
Return type

dict

Returns

Response Syntax

{
    'Configuration': {
        'FunctionName': 'string',
        'FunctionArn': 'string',
        'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
        'Role': 'string',
        'Handler': 'string',
        'CodeSize': 123,
        'Description': 'string',
        'Timeout': 123,
        'MemorySize': 123,
        'LastModified': 'string',
        'CodeSha256': 'string',
        'Version': 'string',
        'VpcConfig': {
            'SubnetIds': [
                'string',
            ],
            'SecurityGroupIds': [
                'string',
            ],
            'VpcId': 'string'
        },
        'DeadLetterConfig': {
            'TargetArn': 'string'
        },
        'Environment': {
            'Variables': {
                'string': 'string'
            },
            'Error': {
                'ErrorCode': 'string',
                'Message': 'string'
            }
        },
        'KMSKeyArn': 'string',
        'TracingConfig': {
            'Mode': 'Active'|'PassThrough'
        },
        'MasterArn': 'string',
        'RevisionId': 'string',
        'Layers': [
            {
                'Arn': 'string',
                'CodeSize': 123
            },
        ]
    },
    'Code': {
        'RepositoryType': 'string',
        'Location': 'string'
    },
    'Tags': {
        'string': 'string'
    },
    'Concurrency': {
        'ReservedConcurrentExecutions': 123
    }
}

Response Structure

  • (dict) --

    • Configuration (dict) --

      The configuration of the function or version.

      • FunctionName (string) --

        The name of the function.

      • FunctionArn (string) --

        The function's Amazon Resource Name (ARN).

      • Runtime (string) --

        The runtime environment for the Lambda function.

      • Role (string) --

        The function's execution role.

      • Handler (string) --

        The function that Lambda calls to begin executing your function.

      • CodeSize (integer) --

        The size of the function's deployment package, in bytes.

      • Description (string) --

        The function's description.

      • Timeout (integer) --

        The amount of time that Lambda allows a function to run before stopping it.

      • MemorySize (integer) --

        The memory that's allocated to the function.

      • LastModified (string) --

        The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

      • CodeSha256 (string) --

        The SHA256 hash of the function's deployment package.

      • Version (string) --

        The version of the Lambda function.

      • VpcConfig (dict) --

        The function's networking configuration.

        • SubnetIds (list) --

          A list of VPC subnet IDs.

          • (string) --
        • SecurityGroupIds (list) --

          A list of VPC security groups IDs.

          • (string) --
        • VpcId (string) --

          The ID of the VPC.

      • DeadLetterConfig (dict) --

        The function's dead letter queue.

        • TargetArn (string) --

          The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

      • Environment (dict) --

        The function's environment variables.

        • Variables (dict) --

          Environment variable key-value pairs.

          • (string) --
            • (string) --
        • Error (dict) --

          Error messages for environment variables that couldn't be applied.

          • ErrorCode (string) --

            The error code.

          • Message (string) --

            The error message.

      • KMSKeyArn (string) --

        The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

      • TracingConfig (dict) --

        The function's AWS X-Ray tracing configuration.

        • Mode (string) --

          The tracing mode.

      • MasterArn (string) --

        For Lambda@Edge functions, the ARN of the master function.

      • RevisionId (string) --

        The latest updated revision of the function or alias.

      • Layers (list) --

        The function's layers .

        • (dict) --

          An AWS Lambda layer .

          • Arn (string) --

            The Amazon Resource Name (ARN) of the function layer.

          • CodeSize (integer) --

            The size of the layer archive in bytes.

    • Code (dict) --

      The deployment package of the function or version.

      • RepositoryType (string) --

        The service that's hosting the file.

      • Location (string) --

        A presigned URL that you can use to download the deployment package.

    • Tags (dict) --

      The function's tags .

      • (string) --
        • (string) --
    • Concurrency (dict) --

      The function's reserved concurrency .

      • ReservedConcurrentExecutions (integer) --

        The number of concurrent executions that are reserved for this function. For more information, see Managing Concurrency .

Examples

This operation retrieves a Lambda function's event source mapping

response = client.get_function(
    FunctionName='myFunction',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Code': {
        'Location': 'somelocation',
        'RepositoryType': 'S3',
    },
    'Configuration': {
        'CodeSha256': 'LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=',
        'CodeSize': 262,
        'Description': 'A starter AWS Lambda function.',
        'Environment': {
            'Variables': {
                'S3_BUCKET': 'test',
            },
        },
        'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
        'FunctionName': 'myFunction',
        'Handler': 'index.handler',
        'LastModified': '2016-11-21T19:49:20.006+0000',
        'MemorySize': 128,
        'Role': 'arn:aws:iam::123456789012:role/lambda_basic_execution',
        'Runtime': 'nodejs4.3',
        'Timeout': 3,
        'Version': '$LATEST',
        'VpcConfig': {
            'SecurityGroupIds': [
            ],
            'SubnetIds': [
            ],
        },
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
get_function_configuration(**kwargs)

Returns the version-specific settings of a Lambda function or version. The output includes only options that can vary between versions of a function. To modify these settings, use UpdateFunctionConfiguration .

To get all of a function's details, including function-level settings, use GetFunction .

See also: AWS API Documentation

Request Syntax

response = client.get_function_configuration(
    FunctionName='string',
    Qualifier='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Qualifier (string) -- Specify a version or alias to get details about a published version of the function.
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string',
    'VpcConfig': {
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ],
        'VpcId': 'string'
    },
    'DeadLetterConfig': {
        'TargetArn': 'string'
    },
    'Environment': {
        'Variables': {
            'string': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'KMSKeyArn': 'string',
    'TracingConfig': {
        'Mode': 'Active'|'PassThrough'
    },
    'MasterArn': 'string',
    'RevisionId': 'string',
    'Layers': [
        {
            'Arn': 'string',
            'CodeSize': 123
        },
    ]
}

Response Structure

  • (dict) --

    Details about a function's configuration.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The function's Amazon Resource Name (ARN).

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The function's execution role.

    • Handler (string) --

      The function that Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size of the function's deployment package, in bytes.

    • Description (string) --

      The function's description.

    • Timeout (integer) --

      The amount of time that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The memory that's allocated to the function.

    • LastModified (string) --

      The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • CodeSha256 (string) --

      The SHA256 hash of the function's deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      The function's networking configuration.

      • SubnetIds (list) --

        A list of VPC subnet IDs.

        • (string) --
      • SecurityGroupIds (list) --

        A list of VPC security groups IDs.

        • (string) --
      • VpcId (string) --

        The ID of the VPC.

    • DeadLetterConfig (dict) --

      The function's dead letter queue.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment (dict) --

      The function's environment variables.

      • Variables (dict) --

        Environment variable key-value pairs.

        • (string) --
          • (string) --
      • Error (dict) --

        Error messages for environment variables that couldn't be applied.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

    • KMSKeyArn (string) --

      The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

    • TracingConfig (dict) --

      The function's AWS X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

      For Lambda@Edge functions, the ARN of the master function.

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers .

      • (dict) --

        An AWS Lambda layer .

        • Arn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize (integer) --

          The size of the layer archive in bytes.

Examples

This operation retrieves a Lambda function's event source mapping

response = client.get_function_configuration(
    FunctionName='myFunction',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'CodeSha256': 'LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=',
    'CodeSize': 123,
    'DeadLetterConfig': {
    },
    'Description': '',
    'Environment': {
    },
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'FunctionName': 'myFunction',
    'Handler': 'index.handler',
    'KMSKeyArn': '',
    'LastModified': '2016-11-21T19:49:20.006+0000',
    'MemorySize': 128,
    'Role': 'arn:aws:iam::123456789012:role/lambda_basic_execution',
    'Runtime': 'python2.7',
    'Timeout': 123,
    'Version': '1',
    'VpcConfig': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
get_layer_version(**kwargs)

Returns information about a version of an AWS Lambda layer , with a link to download the layer archive that's valid for 10 minutes.

See also: AWS API Documentation

Request Syntax

response = client.get_layer_version(
    LayerName='string',
    VersionNumber=123
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • VersionNumber (integer) --

    [REQUIRED]

    The version number.

Return type

dict

Returns

Response Syntax

{
    'Content': {
        'Location': 'string',
        'CodeSha256': 'string',
        'CodeSize': 123
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    ],
    'LicenseInfo': 'string'
}

Response Structure

  • (dict) --

    • Content (dict) --

      Details about the layer version.

      • Location (string) --

        A link to the layer archive in Amazon S3 that is valid for 10 minutes.

      • CodeSha256 (string) --

        The SHA-256 hash of the layer archive.

      • CodeSize (integer) --

        The size of the layer archive in bytes.

    • LayerArn (string) --

      The ARN of the layer.

    • LayerVersionArn (string) --

      The ARN of the layer version.

    • Description (string) --

      The description of the version.

    • CreatedDate (string) --

      The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • Version (integer) --

      The version number.

    • CompatibleRuntimes (list) --

      The layer's compatible runtimes.

      • (string) --
    • LicenseInfo (string) --

      The layer's software license.

get_layer_version_by_arn(**kwargs)

Returns information about a version of an AWS Lambda layer , with a link to download the layer archive that's valid for 10 minutes.

See also: AWS API Documentation

Request Syntax

response = client.get_layer_version_by_arn(
    Arn='string'
)
Parameters
Arn (string) --

[REQUIRED]

The ARN of the layer version.

Return type
dict
Returns
Response Syntax
{
    'Content': {
        'Location': 'string',
        'CodeSha256': 'string',
        'CodeSize': 123
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    ],
    'LicenseInfo': 'string'
}

Response Structure

  • (dict) --
    • Content (dict) --

      Details about the layer version.

      • Location (string) --

        A link to the layer archive in Amazon S3 that is valid for 10 minutes.

      • CodeSha256 (string) --

        The SHA-256 hash of the layer archive.

      • CodeSize (integer) --

        The size of the layer archive in bytes.

    • LayerArn (string) --

      The ARN of the layer.

    • LayerVersionArn (string) --

      The ARN of the layer version.

    • Description (string) --

      The description of the version.

    • CreatedDate (string) --

      The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • Version (integer) --

      The version number.

    • CompatibleRuntimes (list) --

      The layer's compatible runtimes.

      • (string) --
    • LicenseInfo (string) --

      The layer's software license.

get_layer_version_policy(**kwargs)

Returns the permission policy for a version of an AWS Lambda layer . For more information, see AddLayerVersionPermission .

See also: AWS API Documentation

Request Syntax

response = client.get_layer_version_policy(
    LayerName='string',
    VersionNumber=123
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • VersionNumber (integer) --

    [REQUIRED]

    The version number.

Return type

dict

Returns

Response Syntax

{
    'Policy': 'string',
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    • Policy (string) --

      The policy document.

    • RevisionId (string) --

      A unique identifier for the current revision of the policy.

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_policy(**kwargs)

Returns the resource-based IAM policy for a function, version, or alias.

See also: AWS API Documentation

Request Syntax

response = client.get_policy(
    FunctionName='string',
    Qualifier='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Qualifier (string) -- Specify a version or alias to get the policy for that resource.
Return type

dict

Returns

Response Syntax

{
    'Policy': 'string',
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    • Policy (string) --

      The resource-based policy.

    • RevisionId (string) --

      A unique identifier for the current revision of the policy.

Examples

This operation retrieves a Lambda function policy

response = client.get_policy(
    FunctionName='myFunction',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Policy': '',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
invoke(**kwargs)

Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. To invoke a function asynchronously, set InvocationType to Event .

For synchronous invocation, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the execution log and trace . To record function errors for asynchronous invocations, configure your function with a dead letter queue .

When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see Retry Behavior .

The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, limit errors , or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if executing the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded ) or function level (ReservedFunctionConcurrentInvocationLimitExceeded ).

For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.

This operation requires permission for the lambda:InvokeFunction action.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • InvocationType (string) --

    Choose from the following options.

    • RequestResponse (default) - Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.
    • Event - Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if it's configured). The API response only includes a status code.
    • DryRun - Validate parameter values and verify that the user or role has permission to invoke the function.
  • LogType (string) -- Set to Tail to include the execution log in the response.
  • ClientContext (string) -- Up to 3583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
  • Payload (bytes or seekable file-like object) -- The JSON that you want to provide to your Lambda function as input.
  • Qualifier (string) -- Specify a version or alias to invoke a published version of the function.
Return type

dict

Returns

Response Syntax

{
    'StatusCode': 123,
    'FunctionError': 'string',
    'LogResult': 'string',
    'Payload': StreamingBody(),
    'ExecutedVersion': 'string'
}

Response Structure

  • (dict) --

    • StatusCode (integer) --

      The HTTP status code is in the 200 range for a successful request. For the RequestResponse invocation type, this status code is 200. For the Event invocation type, this status code is 202. For the DryRun invocation type, the status code is 204.

    • FunctionError (string) --

      If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.

      • Handled - The runtime caught an error thrown by the function and formatted it into a JSON document.
      • Unhandled - The runtime didn't handle the error. For example, the function ran out of memory or timed out.
    • LogResult (string) --

      The last 4 KB of the execution log, which is base64 encoded.

    • Payload (StreamingBody) --

      The response from the function, or an error object.

    • ExecutedVersion (string) --

      The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.

Examples

This operation invokes a Lambda function

response = client.invoke(
    ClientContext='MyApp',
    FunctionName='MyFunction',
    InvocationType='Event',
    LogType='Tail',
    Payload='fileb://file-path/input.json',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'FunctionError': '',
    'LogResult': '',
    'Payload': '?',
    'StatusCode': 123,
    'ResponseMetadata': {
        '...': '...',
    },
}
invoke_async(**kwargs)

Warning

For asynchronous function invocation, use Invoke .

Invokes a function asynchronously.

Danger

This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.

See also: AWS API Documentation

Request Syntax

response = client.invoke_async(
    FunctionName='string',
    InvokeArgs=b'bytes'|file
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - my-function .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

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

    [REQUIRED]

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

Return type

dict

Returns

Response Syntax

{
    'Status': 123
}

Response Structure

  • (dict) --

    A success response (202 Accepted ) indicates that the request is queued for invocation.

    • Status (integer) --

      The status code.

Examples

This operation invokes a Lambda function asynchronously

response = client.invoke_async(
    FunctionName='myFunction',
    InvokeArgs='fileb://file-path/input.json',
)

print(response)

Expected Output:

{
    'Status': 123,
    'ResponseMetadata': {
        '...': '...',
    },
}
list_aliases(**kwargs)

Returns a list of aliases for a Lambda function.

See also: AWS API Documentation

Request Syntax

response = client.list_aliases(
    FunctionName='string',
    FunctionVersion='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • FunctionVersion (string) -- Specify a function version to only list aliases that invoke that version.
  • Marker (string) -- Specify the pagination token that's returned by a previous request to retrieve the next page of results.
  • MaxItems (integer) -- Limit the number of aliases returned.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Aliases': [
        {
            'AliasArn': 'string',
            'Name': 'string',
            'FunctionVersion': 'string',
            'Description': 'string',
            'RoutingConfig': {
                'AdditionalVersionWeights': {
                    'string': 123.0
                }
            },
            'RevisionId': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      The pagination token that's included if more results are available.

    • Aliases (list) --

      A list of aliases.

      • (dict) --

        Provides configuration information about a Lambda function alias .

        • AliasArn (string) --

          The Amazon Resource Name (ARN) of the alias.

        • Name (string) --

          The name of the alias.

        • FunctionVersion (string) --

          The function version that the alias invokes.

        • Description (string) --

          A description of the alias.

        • RoutingConfig (dict) --

          The routing configuration of the alias.

          • AdditionalVersionWeights (dict) --

            The name of the second alias, and the percentage of traffic that's routed to it.

            • (string) --
              • (float) --
        • RevisionId (string) --

          A unique identifier that changes when you update the alias.

Examples

This operation retrieves a Lambda function's aliases

response = client.list_aliases(
    FunctionName='myFunction',
    FunctionVersion='1',
    Marker='',
    MaxItems=123,
)

print(response)

Expected Output:

{
    'Aliases': [
    ],
    'NextMarker': '',
    'ResponseMetadata': {
        '...': '...',
    },
}
list_event_source_mappings(**kwargs)

Lists event source mappings. Specify an EventSourceArn to only show event source mappings for a single event source.

See also: AWS API Documentation

Request Syntax

response = client.list_event_source_mappings(
    EventSourceArn='string',
    FunctionName='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • EventSourceArn (string) --

    The Amazon Resource Name (ARN) of the event source.

    • Amazon Kinesis - The ARN of the data stream or a stream consumer.
    • Amazon DynamoDB Streams - The ARN of the stream.
    • Amazon Simple Queue Service - The ARN of the queue.
  • FunctionName (string) --

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

  • Marker (string) -- A pagination token returned by a previous call.
  • MaxItems (integer) -- The maximum number of event source mappings to return.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'EventSourceMappings': [
        {
            'UUID': 'string',
            'BatchSize': 123,
            'EventSourceArn': 'string',
            'FunctionArn': 'string',
            'LastModified': datetime(2015, 1, 1),
            'LastProcessingResult': 'string',
            'State': 'string',
            'StateTransitionReason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      A pagination token that's returned when the response doesn't contain all event source mappings.

    • EventSourceMappings (list) --

      A list of event source mappings.

      • (dict) --

        A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

        • UUID (string) --

          The identifier of the event source mapping.

        • BatchSize (integer) --

          The maximum number of items to retrieve in a single batch.

        • EventSourceArn (string) --

          The Amazon Resource Name (ARN) of the event source.

        • FunctionArn (string) --

          The ARN of the Lambda function.

        • LastModified (datetime) --

          The date that the event source mapping was last updated.

        • LastProcessingResult (string) --

          The result of the last AWS Lambda invocation of your Lambda function.

        • State (string) --

          The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

        • StateTransitionReason (string) --

          The cause of the last state change, either User initiated or Lambda initiated .

list_functions(**kwargs)

Returns a list of Lambda functions, with the version-specific configuration of each.

Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version. To get more information about a function or version, use GetFunction .

See also: AWS API Documentation

Request Syntax

response = client.list_functions(
    MasterRegion='string',
    FunctionVersion='ALL',
    Marker='string',
    MaxItems=123
)
Parameters
  • MasterRegion (string) -- For Lambda@Edge functions, the AWS Region of the master function. For example, us-east-2 or ALL . If specified, you must set FunctionVersion to ALL .
  • FunctionVersion (string) -- Set to ALL to include entries for all published versions of each function.
  • Marker (string) -- Specify the pagination token that's returned by a previous request to retrieve the next page of results.
  • MaxItems (integer) -- Specify a value between 1 and 50 to limit the number of functions in the response.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Functions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string',
            'VpcConfig': {
                'SubnetIds': [
                    'string',
                ],
                'SecurityGroupIds': [
                    'string',
                ],
                'VpcId': 'string'
            },
            'DeadLetterConfig': {
                'TargetArn': 'string'
            },
            'Environment': {
                'Variables': {
                    'string': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'KMSKeyArn': 'string',
            'TracingConfig': {
                'Mode': 'Active'|'PassThrough'
            },
            'MasterArn': 'string',
            'RevisionId': 'string',
            'Layers': [
                {
                    'Arn': 'string',
                    'CodeSize': 123
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    A list of Lambda functions.

    • NextMarker (string) --

      The pagination token that's included if more results are available.

    • Functions (list) --

      A list of Lambda functions.

      • (dict) --

        Details about a function's configuration.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The function's Amazon Resource Name (ARN).

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The function's execution role.

        • Handler (string) --

          The function that Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size of the function's deployment package, in bytes.

        • Description (string) --

          The function's description.

        • Timeout (integer) --

          The amount of time that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The memory that's allocated to the function.

        • LastModified (string) --

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 (string) --

          The SHA256 hash of the function's deployment package.

        • Version (string) --

          The version of the Lambda function.

        • VpcConfig (dict) --

          The function's networking configuration.

          • SubnetIds (list) --

            A list of VPC subnet IDs.

            • (string) --
          • SecurityGroupIds (list) --

            A list of VPC security groups IDs.

            • (string) --
          • VpcId (string) --

            The ID of the VPC.

        • DeadLetterConfig (dict) --

          The function's dead letter queue.

          • TargetArn (string) --

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment (dict) --

          The function's environment variables.

          • Variables (dict) --

            Environment variable key-value pairs.

            • (string) --
              • (string) --
          • Error (dict) --

            Error messages for environment variables that couldn't be applied.

            • ErrorCode (string) --

              The error code.

            • Message (string) --

              The error message.

        • KMSKeyArn (string) --

          The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

        • TracingConfig (dict) --

          The function's AWS X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers .

          • (dict) --

            An AWS Lambda layer .

            • Arn (string) --

              The Amazon Resource Name (ARN) of the function layer.

            • CodeSize (integer) --

              The size of the layer archive in bytes.

Examples

This operation retrieves a Lambda functions

response = client.list_functions(
    Marker='',
    MaxItems=123,
)

print(response)

Expected Output:

{
    'Functions': [
    ],
    'NextMarker': '',
    'ResponseMetadata': {
        '...': '...',
    },
}
list_layer_versions(**kwargs)

Lists the versions of an AWS Lambda layer . Versions that have been deleted aren't listed. Specify a runtime identifier to list only versions that indicate that they're compatible with that runtime.

See also: AWS API Documentation

Request Syntax

response = client.list_layer_versions(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    LayerName='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • CompatibleRuntime (string) -- A runtime identifier. For example, go1.x .
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • Marker (string) -- A pagination token returned by a previous call.
  • MaxItems (integer) -- The maximum number of versions to return.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'LayerVersions': [
        {
            'LayerVersionArn': 'string',
            'Version': 123,
            'Description': 'string',
            'CreatedDate': 'string',
            'CompatibleRuntimes': [
                'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            ],
            'LicenseInfo': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      A pagination token returned when the response doesn't contain all versions.

    • LayerVersions (list) --

      A list of versions.

      • (dict) --

        Details about a version of an AWS Lambda layer .

        • LayerVersionArn (string) --

          The ARN of the layer version.

        • Version (integer) --

          The version number.

        • Description (string) --

          The description of the version.

        • CreatedDate (string) --

          The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000 .

        • CompatibleRuntimes (list) --

          The layer's compatible runtimes.

          • (string) --
        • LicenseInfo (string) --

          The layer's open-source license.

list_layers(**kwargs)

Lists AWS Lambda layers and shows information about the latest version of each. Specify a runtime identifier to list only layers that indicate that they're compatible with that runtime.

See also: AWS API Documentation

Request Syntax

response = client.list_layers(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    Marker='string',
    MaxItems=123
)
Parameters
  • CompatibleRuntime (string) -- A runtime identifier. For example, go1.x .
  • Marker (string) -- A pagination token returned by a previous call.
  • MaxItems (integer) -- The maximum number of layers to return.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Layers': [
        {
            'LayerName': 'string',
            'LayerArn': 'string',
            'LatestMatchingVersion': {
                'LayerVersionArn': 'string',
                'Version': 123,
                'Description': 'string',
                'CreatedDate': 'string',
                'CompatibleRuntimes': [
                    'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
                ],
                'LicenseInfo': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      A pagination token returned when the response doesn't contain all layers.

    • Layers (list) --

      A list of function layers.

      • (dict) --

        Details about an AWS Lambda layer .

        • LayerName (string) --

          The name of the layer.

        • LayerArn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • LatestMatchingVersion (dict) --

          The newest version of the layer.

          • LayerVersionArn (string) --

            The ARN of the layer version.

          • Version (integer) --

            The version number.

          • Description (string) --

            The description of the version.

          • CreatedDate (string) --

            The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000 .

          • CompatibleRuntimes (list) --

            The layer's compatible runtimes.

            • (string) --
          • LicenseInfo (string) --

            The layer's open-source license.

list_tags(**kwargs)

Returns a function's tags . You can also view tags with GetFunction .

See also: AWS API Documentation

Request Syntax

response = client.list_tags(
    Resource='string'
)
Parameters
Resource (string) --

[REQUIRED]

The function's Amazon Resource Name (ARN).

Return type
dict
Returns
Response Syntax
{
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --
    • Tags (dict) --

      The function's tags.

      • (string) --
        • (string) --
list_versions_by_function(**kwargs)

Returns a list of versions , with the version-specific configuration of each.

See also: AWS API Documentation

Request Syntax

response = client.list_versions_by_function(
    FunctionName='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Marker (string) -- Specify the pagination token that's returned by a previous request to retrieve the next page of results.
  • MaxItems (integer) -- Limit the number of versions that are returned.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Versions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string',
            'VpcConfig': {
                'SubnetIds': [
                    'string',
                ],
                'SecurityGroupIds': [
                    'string',
                ],
                'VpcId': 'string'
            },
            'DeadLetterConfig': {
                'TargetArn': 'string'
            },
            'Environment': {
                'Variables': {
                    'string': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'KMSKeyArn': 'string',
            'TracingConfig': {
                'Mode': 'Active'|'PassThrough'
            },
            'MasterArn': 'string',
            'RevisionId': 'string',
            'Layers': [
                {
                    'Arn': 'string',
                    'CodeSize': 123
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

      The pagination token that's included if more results are available.

    • Versions (list) --

      A list of Lambda function versions.

      • (dict) --

        Details about a function's configuration.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The function's Amazon Resource Name (ARN).

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The function's execution role.

        • Handler (string) --

          The function that Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size of the function's deployment package, in bytes.

        • Description (string) --

          The function's description.

        • Timeout (integer) --

          The amount of time that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The memory that's allocated to the function.

        • LastModified (string) --

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 (string) --

          The SHA256 hash of the function's deployment package.

        • Version (string) --

          The version of the Lambda function.

        • VpcConfig (dict) --

          The function's networking configuration.

          • SubnetIds (list) --

            A list of VPC subnet IDs.

            • (string) --
          • SecurityGroupIds (list) --

            A list of VPC security groups IDs.

            • (string) --
          • VpcId (string) --

            The ID of the VPC.

        • DeadLetterConfig (dict) --

          The function's dead letter queue.

          • TargetArn (string) --

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment (dict) --

          The function's environment variables.

          • Variables (dict) --

            Environment variable key-value pairs.

            • (string) --
              • (string) --
          • Error (dict) --

            Error messages for environment variables that couldn't be applied.

            • ErrorCode (string) --

              The error code.

            • Message (string) --

              The error message.

        • KMSKeyArn (string) --

          The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

        • TracingConfig (dict) --

          The function's AWS X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers .

          • (dict) --

            An AWS Lambda layer .

            • Arn (string) --

              The Amazon Resource Name (ARN) of the function layer.

            • CodeSize (integer) --

              The size of the layer archive in bytes.

Examples

This operation retrieves a Lambda function versions

response = client.list_versions_by_function(
    FunctionName='myFunction',
    Marker='',
    MaxItems=123,
)

print(response)

Expected Output:

{
    'NextMarker': '',
    'Versions': [
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
publish_layer_version(**kwargs)

Creates an AWS Lambda layer from a ZIP archive. Each time you call PublishLayerVersion with the same version name, a new version is created.

Add layers to your function with CreateFunction or UpdateFunctionConfiguration .

See also: AWS API Documentation

Request Syntax

response = client.publish_layer_version(
    LayerName='string',
    Description='string',
    Content={
        'S3Bucket': 'string',
        'S3Key': 'string',
        'S3ObjectVersion': 'string',
        'ZipFile': b'bytes'
    },
    CompatibleRuntimes=[
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    ],
    LicenseInfo='string'
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • Description (string) -- The description of the version.
  • Content (dict) --

    [REQUIRED]

    The function layer archive.

    • S3Bucket (string) --

      The Amazon S3 bucket of the layer archive.

    • S3Key (string) --

      The Amazon S3 key of the layer archive.

    • S3ObjectVersion (string) --

      For versioned objects, the version of the layer archive object to use.

    • ZipFile (bytes) --

      The base64-encoded contents of the layer archive. AWS SDK and AWS CLI clients handle the encoding for you.

  • CompatibleRuntimes (list) --

    A list of compatible function runtimes . Used for filtering with ListLayers and ListLayerVersions .

    • (string) --
  • LicenseInfo (string) --

    The layer's software license. It can be any of the following:

    • An SPDX license identifier . For example, MIT .
    • The URL of a license hosted on the internet. For example, https://opensource.org/licenses/MIT .
    • The full text of the license.
Return type

dict

Returns

Response Syntax

{
    'Content': {
        'Location': 'string',
        'CodeSha256': 'string',
        'CodeSize': 123
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    ],
    'LicenseInfo': 'string'
}

Response Structure

  • (dict) --

    • Content (dict) --

      Details about the layer version.

      • Location (string) --

        A link to the layer archive in Amazon S3 that is valid for 10 minutes.

      • CodeSha256 (string) --

        The SHA-256 hash of the layer archive.

      • CodeSize (integer) --

        The size of the layer archive in bytes.

    • LayerArn (string) --

      The ARN of the layer.

    • LayerVersionArn (string) --

      The ARN of the layer version.

    • Description (string) --

      The description of the version.

    • CreatedDate (string) --

      The date that the layer version was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • Version (integer) --

      The version number.

    • CompatibleRuntimes (list) --

      The layer's compatible runtimes.

      • (string) --
    • LicenseInfo (string) --

      The layer's software license.

publish_version(**kwargs)

Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.

AWS Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version.

Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias .

See also: AWS API Documentation

Request Syntax

response = client.publish_version(
    FunctionName='string',
    CodeSha256='string',
    Description='string',
    RevisionId='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • CodeSha256 (string) -- Only publish a version if the hash value matches the value that's specified. Use this option to avoid publishing a version if the function code has changed since you last updated it. You can get the hash for the version that you uploaded from the output of UpdateFunctionCode .
  • Description (string) -- A description for the version to override the description in the function configuration.
  • RevisionId (string) -- Only update the function if the revision ID matches the ID that's specified. Use this option to avoid publishing a version if the function configuration has changed since you last updated it.
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string',
    'VpcConfig': {
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ],
        'VpcId': 'string'
    },
    'DeadLetterConfig': {
        'TargetArn': 'string'
    },
    'Environment': {
        'Variables': {
            'string': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'KMSKeyArn': 'string',
    'TracingConfig': {
        'Mode': 'Active'|'PassThrough'
    },
    'MasterArn': 'string',
    'RevisionId': 'string',
    'Layers': [
        {
            'Arn': 'string',
            'CodeSize': 123
        },
    ]
}

Response Structure

  • (dict) --

    Details about a function's configuration.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The function's Amazon Resource Name (ARN).

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The function's execution role.

    • Handler (string) --

      The function that Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size of the function's deployment package, in bytes.

    • Description (string) --

      The function's description.

    • Timeout (integer) --

      The amount of time that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The memory that's allocated to the function.

    • LastModified (string) --

      The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • CodeSha256 (string) --

      The SHA256 hash of the function's deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      The function's networking configuration.

      • SubnetIds (list) --

        A list of VPC subnet IDs.

        • (string) --
      • SecurityGroupIds (list) --

        A list of VPC security groups IDs.

        • (string) --
      • VpcId (string) --

        The ID of the VPC.

    • DeadLetterConfig (dict) --

      The function's dead letter queue.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment (dict) --

      The function's environment variables.

      • Variables (dict) --

        Environment variable key-value pairs.

        • (string) --
          • (string) --
      • Error (dict) --

        Error messages for environment variables that couldn't be applied.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

    • KMSKeyArn (string) --

      The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

    • TracingConfig (dict) --

      The function's AWS X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

      For Lambda@Edge functions, the ARN of the master function.

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers .

      • (dict) --

        An AWS Lambda layer .

        • Arn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize (integer) --

          The size of the layer archive in bytes.

Examples

This operation publishes a version of a Lambda function

response = client.publish_version(
    CodeSha256='',
    Description='',
    FunctionName='myFunction',
)

print(response)

Expected Output:

{
    'CodeSha256': '',
    'CodeSize': 123,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction:1',
    'FunctionName': 'myFunction',
    'Handler': 'index.handler',
    'LastModified': '2016-11-21T19:49:20.006+0000',
    'MemorySize': 128,
    'Role': 'arn:aws:iam::123456789012:role/lambda_basic_execution',
    'Runtime': 'python2.7',
    'Timeout': 123,
    'Version': '1',
    'VpcConfig': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
put_function_concurrency(**kwargs)

Sets the maximum number of simultaneous executions for a function, and reserves capacity for that concurrency level.

Concurrency settings apply to the function as a whole, including all published versions and the unpublished version. Reserving concurrency both ensures that your function has capacity to process the specified number of events simultaneously, and prevents it from scaling beyond that level. Use GetFunction to see the current setting for a function.

Use GetAccountSettings to see your regional concurrency limit. You can reserve concurrency for as many functions as you like, as long as you leave at least 100 simultaneous executions unreserved for functions that aren't configured with a per-function limit. For more information, see Managing Concurrency .

See also: AWS API Documentation

Request Syntax

response = client.put_function_concurrency(
    FunctionName='string',
    ReservedConcurrentExecutions=123
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - my-function .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • ReservedConcurrentExecutions (integer) --

    [REQUIRED]

    The number of simultaneous executions to reserve for the function.

Return type

dict

Returns

Response Syntax

{
    'ReservedConcurrentExecutions': 123
}

Response Structure

  • (dict) --

    • ReservedConcurrentExecutions (integer) --

      The number of concurrent executions that are reserved for this function. For more information, see Managing Concurrency .

remove_layer_version_permission(**kwargs)

Removes a statement from the permissions policy for a version of an AWS Lambda layer . For more information, see AddLayerVersionPermission .

See also: AWS API Documentation

Request Syntax

response = client.remove_layer_version_permission(
    LayerName='string',
    VersionNumber=123,
    StatementId='string',
    RevisionId='string'
)
Parameters
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • VersionNumber (integer) --

    [REQUIRED]

    The version number.

  • StatementId (string) --

    [REQUIRED]

    The identifier that was specified when the statement was added.

  • RevisionId (string) -- Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.
Returns

None

remove_permission(**kwargs)

Revokes function-use permission from an AWS service or another account. You can get the ID of the statement from the output of GetPolicy .

See also: AWS API Documentation

Request Syntax

response = client.remove_permission(
    FunctionName='string',
    StatementId='string',
    Qualifier='string',
    RevisionId='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • StatementId (string) --

    [REQUIRED]

    Statement ID of the permission to remove.

  • Qualifier (string) -- Specify a version or alias to remove permissions from a published version of the function.
  • RevisionId (string) -- Only update the policy if the revision ID matches the ID that's specified. Use this option to avoid modifying a policy that has changed since you last read it.
Returns

None

Examples

This operation removes a Lambda function's permissions

response = client.remove_permission(
    FunctionName='myFunction',
    Qualifier='1',
    StatementId='role-statement-id',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
tag_resource(**kwargs)

Adds tags to a function.

See also: AWS API Documentation

Request Syntax

response = client.tag_resource(
    Resource='string',
    Tags={
        'string': 'string'
    }
)
Parameters
  • Resource (string) --

    [REQUIRED]

    The function's Amazon Resource Name (ARN).

  • Tags (dict) --

    [REQUIRED]

    A list of tags to apply to the function.

    • (string) --
      • (string) --
Returns

None

untag_resource(**kwargs)

Removes tags from a function.

See also: AWS API Documentation

Request Syntax

response = client.untag_resource(
    Resource='string',
    TagKeys=[
        'string',
    ]
)
Parameters
  • Resource (string) --

    [REQUIRED]

    The function's Amazon Resource Name (ARN).

  • TagKeys (list) --

    [REQUIRED]

    A list of tag keys to remove from the function.

    • (string) --
Returns

None

update_alias(**kwargs)

Updates the configuration of a Lambda function alias .

See also: AWS API Documentation

Request Syntax

response = client.update_alias(
    FunctionName='string',
    Name='string',
    FunctionVersion='string',
    Description='string',
    RoutingConfig={
        'AdditionalVersionWeights': {
            'string': 123.0
        }
    },
    RevisionId='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Name (string) --

    [REQUIRED]

    The name of the alias.

  • FunctionVersion (string) -- The function version that the alias invokes.
  • Description (string) -- A description of the alias.
  • RoutingConfig (dict) --

    The routing configuration of the alias.

    • AdditionalVersionWeights (dict) --

      The name of the second alias, and the percentage of traffic that's routed to it.

      • (string) --
        • (float) --
  • RevisionId (string) -- Only update the alias if the revision ID matches the ID that's specified. Use this option to avoid modifying an alias that has changed since you last read it.
Return type

dict

Returns

Response Syntax

{
    'AliasArn': 'string',
    'Name': 'string',
    'FunctionVersion': 'string',
    'Description': 'string',
    'RoutingConfig': {
        'AdditionalVersionWeights': {
            'string': 123.0
        }
    },
    'RevisionId': 'string'
}

Response Structure

  • (dict) --

    Provides configuration information about a Lambda function alias .

    • AliasArn (string) --

      The Amazon Resource Name (ARN) of the alias.

    • Name (string) --

      The name of the alias.

    • FunctionVersion (string) --

      The function version that the alias invokes.

    • Description (string) --

      A description of the alias.

    • RoutingConfig (dict) --

      The routing configuration of the alias.

      • AdditionalVersionWeights (dict) --

        The name of the second alias, and the percentage of traffic that's routed to it.

        • (string) --
          • (float) --
    • RevisionId (string) --

      A unique identifier that changes when you update the alias.

Examples

This operation updates a Lambda function alias

response = client.update_alias(
    Description='',
    FunctionName='myFunction',
    FunctionVersion='1',
    Name='functionAlias',
)

print(response)

Expected Output:

{
    'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:functionAlias',
    'Description': '',
    'FunctionVersion': '1',
    'Name': 'functionAlias',
    'ResponseMetadata': {
        '...': '...',
    },
}
update_event_source_mapping(**kwargs)

Updates an event source mapping. You can change the function that AWS Lambda invokes, or pause invocation and resume later from the same location.

See also: AWS API Documentation

Request Syntax

response = client.update_event_source_mapping(
    UUID='string',
    FunctionName='string',
    Enabled=True|False,
    BatchSize=123
)
Parameters
  • UUID (string) --

    [REQUIRED]

    The identifier of the event source mapping.

  • FunctionName (string) --

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

  • Enabled (boolean) -- Disables the event source mapping to pause polling and invocation.
  • BatchSize (integer) --

    The maximum number of items to retrieve in a single batch.

    • Amazon Kinesis - Default 100. Max 10,000.
    • Amazon DynamoDB Streams - Default 100. Max 1,000.
    • Amazon Simple Queue Service - Default 10. Max 10.
Return type

dict

Returns

Response Syntax

{
    'UUID': 'string',
    'BatchSize': 123,
    'EventSourceArn': 'string',
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string'
}

Response Structure

  • (dict) --

    A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

    • UUID (string) --

      The identifier of the event source mapping.

    • BatchSize (integer) --

      The maximum number of items to retrieve in a single batch.

    • EventSourceArn (string) --

      The Amazon Resource Name (ARN) of the event source.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated.

    • LastProcessingResult (string) --

      The result of the last AWS Lambda invocation of your Lambda function.

    • State (string) --

      The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

    • StateTransitionReason (string) --

      The cause of the last state change, either User initiated or Lambda initiated .

Examples

This operation updates a Lambda function event source mapping

response = client.update_event_source_mapping(
    BatchSize=123,
    Enabled=True,
    FunctionName='myFunction',
    UUID='1234xCy789012',
)

print(response)

Expected Output:

{
    'BatchSize': 123,
    'EventSourceArn': 'arn:aws:s3:::examplebucket/*',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'LastProcessingResult': '',
    'State': '',
    'StateTransitionReason': '',
    'UUID': '1234xCy789012',
    'ResponseMetadata': {
        '...': '...',
    },
}
update_function_code(**kwargs)

Updates a Lambda function's code.

The function's code is locked when you publish a version. You can't modify the code of a published version, only the unpublished version.

See also: AWS API Documentation

Request Syntax

response = client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string',
    Publish=True|False,
    DryRun=True|False,
    RevisionId='string'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - my-function .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • ZipFile (bytes) --

    The base64-encoded contents of the deployment package. AWS SDK and AWS CLI clients handle the encoding for you.

    This value will be base64 encoded automatically. Do not base64 encode this value prior to performing the operation.
  • S3Bucket (string) -- An Amazon S3 bucket in the same AWS Region as your function. The bucket can be in a different AWS account.
  • S3Key (string) -- The Amazon S3 key of the deployment package.
  • S3ObjectVersion (string) -- For versioned objects, the version of the deployment package object to use.
  • Publish (boolean) -- Set to true to publish a new version of the function after updating the code. This has the same effect as calling PublishVersion separately.
  • DryRun (boolean) -- Set to true to validate the request parameters and access permissions without modifying the function code.
  • RevisionId (string) -- Only update the function if the revision ID matches the ID that's specified. Use this option to avoid modifying a function that has changed since you last read it.
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string',
    'VpcConfig': {
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ],
        'VpcId': 'string'
    },
    'DeadLetterConfig': {
        'TargetArn': 'string'
    },
    'Environment': {
        'Variables': {
            'string': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'KMSKeyArn': 'string',
    'TracingConfig': {
        'Mode': 'Active'|'PassThrough'
    },
    'MasterArn': 'string',
    'RevisionId': 'string',
    'Layers': [
        {
            'Arn': 'string',
            'CodeSize': 123
        },
    ]
}

Response Structure

  • (dict) --

    Details about a function's configuration.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The function's Amazon Resource Name (ARN).

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The function's execution role.

    • Handler (string) --

      The function that Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size of the function's deployment package, in bytes.

    • Description (string) --

      The function's description.

    • Timeout (integer) --

      The amount of time that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The memory that's allocated to the function.

    • LastModified (string) --

      The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • CodeSha256 (string) --

      The SHA256 hash of the function's deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      The function's networking configuration.

      • SubnetIds (list) --

        A list of VPC subnet IDs.

        • (string) --
      • SecurityGroupIds (list) --

        A list of VPC security groups IDs.

        • (string) --
      • VpcId (string) --

        The ID of the VPC.

    • DeadLetterConfig (dict) --

      The function's dead letter queue.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment (dict) --

      The function's environment variables.

      • Variables (dict) --

        Environment variable key-value pairs.

        • (string) --
          • (string) --
      • Error (dict) --

        Error messages for environment variables that couldn't be applied.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

    • KMSKeyArn (string) --

      The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

    • TracingConfig (dict) --

      The function's AWS X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

      For Lambda@Edge functions, the ARN of the master function.

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers .

      • (dict) --

        An AWS Lambda layer .

        • Arn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize (integer) --

          The size of the layer archive in bytes.

Examples

This operation updates a Lambda function's code

response = client.update_function_code(
    FunctionName='myFunction',
    Publish=True,
    S3Bucket='myBucket',
    S3Key='myKey',
    S3ObjectVersion='1',
    ZipFile='fileb://file-path/file.zip',
)

print(response)

Expected Output:

{
    'CodeSha256': 'LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=',
    'CodeSize': 123,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'FunctionName': 'myFunction',
    'Handler': 'index.handler',
    'LastModified': '2016-11-21T19:49:20.006+0000',
    'MemorySize': 128,
    'Role': 'arn:aws:iam::123456789012:role/lambda_basic_execution',
    'Runtime': 'python2.7',
    'Timeout': 123,
    'Version': '1',
    'VpcConfig': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
update_function_configuration(**kwargs)

Modify the version-specific settings of a Lambda function.

These settings can vary between versions of a function and are locked when you publish a version. You can't modify the configuration of a published version, only the unpublished version.

To configure function concurrency, use PutFunctionConcurrency . To grant invoke permissions to an account or AWS service, use AddPermission .

See also: AWS API Documentation

Request Syntax

response = client.update_function_configuration(
    FunctionName='string',
    Role='string',
    Handler='string',
    Description='string',
    Timeout=123,
    MemorySize=123,
    VpcConfig={
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ]
    },
    Environment={
        'Variables': {
            'string': 'string'
        }
    },
    Runtime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    DeadLetterConfig={
        'TargetArn': 'string'
    },
    KMSKeyArn='string',
    TracingConfig={
        'Mode': 'Active'|'PassThrough'
    },
    RevisionId='string',
    Layers=[
        'string',
    ]
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - my-function .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Role (string) -- The Amazon Resource Name (ARN) of the function's execution role.
  • Handler (string) -- The name of the method within your code that Lambda calls to execute your function. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Programming Model .
  • Description (string) -- A description of the function.
  • Timeout (integer) -- The amount of time that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds.
  • MemorySize (integer) -- The amount of memory that your function has access to. Increasing the function's memory also increases its CPU allocation. The default value is 128 MB. The value must be a multiple of 64 MB.
  • VpcConfig (dict) --

    For network connectivity to AWS resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can only access resources and the internet through that VPC. For more information, see VPC Settings .

    • SubnetIds (list) --

      A list of VPC subnet IDs.

      • (string) --
    • SecurityGroupIds (list) --

      A list of VPC security groups IDs.

      • (string) --
  • Environment (dict) --

    Environment variables that are accessible from function code during execution.

    • Variables (dict) --

      Environment variable key-value pairs.

      • (string) --
        • (string) --
  • Runtime (string) -- The identifier of the function's runtime .
  • DeadLetterConfig (dict) --

    A dead letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead Letter Queues .

    • TargetArn (string) --

      The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

  • KMSKeyArn (string) -- The ARN of the AWS Key Management Service (AWS KMS) key that's used to encrypt your function's environment variables. If it's not provided, AWS Lambda uses a default service key.
  • TracingConfig (dict) --

    Set Mode to Active to sample and trace a subset of incoming requests with AWS X-Ray.

    • Mode (string) --

      The tracing mode.

  • RevisionId (string) -- Only update the function if the revision ID matches the ID that's specified. Use this option to avoid modifying a function that has changed since you last read it.
  • Layers (list) --

    A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string',
    'CodeSha256': 'string',
    'Version': 'string',
    'VpcConfig': {
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ],
        'VpcId': 'string'
    },
    'DeadLetterConfig': {
        'TargetArn': 'string'
    },
    'Environment': {
        'Variables': {
            'string': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'KMSKeyArn': 'string',
    'TracingConfig': {
        'Mode': 'Active'|'PassThrough'
    },
    'MasterArn': 'string',
    'RevisionId': 'string',
    'Layers': [
        {
            'Arn': 'string',
            'CodeSize': 123
        },
    ]
}

Response Structure

  • (dict) --

    Details about a function's configuration.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

      The function's Amazon Resource Name (ARN).

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

      The function's execution role.

    • Handler (string) --

      The function that Lambda calls to begin executing your function.

    • CodeSize (integer) --

      The size of the function's deployment package, in bytes.

    • Description (string) --

      The function's description.

    • Timeout (integer) --

      The amount of time that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The memory that's allocated to the function.

    • LastModified (string) --

      The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • CodeSha256 (string) --

      The SHA256 hash of the function's deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      The function's networking configuration.

      • SubnetIds (list) --

        A list of VPC subnet IDs.

        • (string) --
      • SecurityGroupIds (list) --

        A list of VPC security groups IDs.

        • (string) --
      • VpcId (string) --

        The ID of the VPC.

    • DeadLetterConfig (dict) --

      The function's dead letter queue.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

    • Environment (dict) --

      The function's environment variables.

      • Variables (dict) --

        Environment variable key-value pairs.

        • (string) --
          • (string) --
      • Error (dict) --

        Error messages for environment variables that couldn't be applied.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

    • KMSKeyArn (string) --

      The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

    • TracingConfig (dict) --

      The function's AWS X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

      For Lambda@Edge functions, the ARN of the master function.

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers .

      • (dict) --

        An AWS Lambda layer .

        • Arn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • CodeSize (integer) --

          The size of the layer archive in bytes.

Examples

This operation updates a Lambda function's configuration

response = client.update_function_configuration(
    Description='',
    FunctionName='myFunction',
    Handler='index.handler',
    MemorySize=128,
    Role='arn:aws:iam::123456789012:role/lambda_basic_execution',
    Runtime='python2.7',
    Timeout=123,
    VpcConfig={
    },
)

print(response)

Expected Output:

{
    'CodeSha256': 'LQT+0DHxxxxcfwLyQjzoEFKZtdqQjHXanlSdfXBlEW0VA=',
    'CodeSize': 123,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:myFunction',
    'FunctionName': 'myFunction',
    'Handler': 'index.handler',
    'LastModified': '2016-11-21T19:49:20.006+0000',
    'MemorySize': 128,
    'Role': 'arn:aws:iam::123456789012:role/lambda_basic_execution',
    'Runtime': 'python2.7',
    'Timeout': 123,
    'Version': '1',
    'VpcConfig': {
    },
    'ResponseMetadata': {
        '...': '...',
    },
}

Paginators

The available paginators are:

class Lambda.Paginator.ListAliases
paginator = client.get_paginator('list_aliases')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_aliases().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    FunctionName='string',
    FunctionVersion='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • FunctionVersion (string) -- Specify a function version to only list aliases that invoke that version.
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Aliases': [
        {
            'AliasArn': 'string',
            'Name': 'string',
            'FunctionVersion': 'string',
            'Description': 'string',
            'RoutingConfig': {
                'AdditionalVersionWeights': {
                    'string': 123.0
                }
            },
            'RevisionId': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Aliases (list) --

      A list of aliases.

      • (dict) --

        Provides configuration information about a Lambda function alias .

        • AliasArn (string) --

          The Amazon Resource Name (ARN) of the alias.

        • Name (string) --

          The name of the alias.

        • FunctionVersion (string) --

          The function version that the alias invokes.

        • Description (string) --

          A description of the alias.

        • RoutingConfig (dict) --

          The routing configuration of the alias.

          • AdditionalVersionWeights (dict) --

            The name of the second alias, and the percentage of traffic that's routed to it.

            • (string) --
              • (float) --
        • RevisionId (string) --

          A unique identifier that changes when you update the alias.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListEventSourceMappings
paginator = client.get_paginator('list_event_source_mappings')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_event_source_mappings().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    EventSourceArn='string',
    FunctionName='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • EventSourceArn (string) --

    The Amazon Resource Name (ARN) of the event source.

    • Amazon Kinesis - The ARN of the data stream or a stream consumer.
    • Amazon DynamoDB Streams - The ARN of the stream.
    • Amazon Simple Queue Service - The ARN of the queue.
  • FunctionName (string) --

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Version or Alias ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'EventSourceMappings': [
        {
            'UUID': 'string',
            'BatchSize': 123,
            'EventSourceArn': 'string',
            'FunctionArn': 'string',
            'LastModified': datetime(2015, 1, 1),
            'LastProcessingResult': 'string',
            'State': 'string',
            'StateTransitionReason': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • EventSourceMappings (list) --

      A list of event source mappings.

      • (dict) --

        A mapping between an AWS resource and an AWS Lambda function. See CreateEventSourceMapping for details.

        • UUID (string) --

          The identifier of the event source mapping.

        • BatchSize (integer) --

          The maximum number of items to retrieve in a single batch.

        • EventSourceArn (string) --

          The Amazon Resource Name (ARN) of the event source.

        • FunctionArn (string) --

          The ARN of the Lambda function.

        • LastModified (datetime) --

          The date that the event source mapping was last updated.

        • LastProcessingResult (string) --

          The result of the last AWS Lambda invocation of your Lambda function.

        • State (string) --

          The state of the event source mapping. It can be one of the following: Creating , Enabling , Enabled , Disabling , Disabled , Updating , or Deleting .

        • StateTransitionReason (string) --

          The cause of the last state change, either User initiated or Lambda initiated .

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListFunctions
paginator = client.get_paginator('list_functions')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_functions().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    MasterRegion='string',
    FunctionVersion='ALL',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • MasterRegion (string) -- For Lambda@Edge functions, the AWS Region of the master function. For example, us-east-2 or ALL . If specified, you must set FunctionVersion to ALL .
  • FunctionVersion (string) -- Set to ALL to include entries for all published versions of each function.
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Functions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string',
            'VpcConfig': {
                'SubnetIds': [
                    'string',
                ],
                'SecurityGroupIds': [
                    'string',
                ],
                'VpcId': 'string'
            },
            'DeadLetterConfig': {
                'TargetArn': 'string'
            },
            'Environment': {
                'Variables': {
                    'string': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'KMSKeyArn': 'string',
            'TracingConfig': {
                'Mode': 'Active'|'PassThrough'
            },
            'MasterArn': 'string',
            'RevisionId': 'string',
            'Layers': [
                {
                    'Arn': 'string',
                    'CodeSize': 123
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    A list of Lambda functions.

    • Functions (list) --

      A list of Lambda functions.

      • (dict) --

        Details about a function's configuration.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The function's Amazon Resource Name (ARN).

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The function's execution role.

        • Handler (string) --

          The function that Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size of the function's deployment package, in bytes.

        • Description (string) --

          The function's description.

        • Timeout (integer) --

          The amount of time that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The memory that's allocated to the function.

        • LastModified (string) --

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 (string) --

          The SHA256 hash of the function's deployment package.

        • Version (string) --

          The version of the Lambda function.

        • VpcConfig (dict) --

          The function's networking configuration.

          • SubnetIds (list) --

            A list of VPC subnet IDs.

            • (string) --
          • SecurityGroupIds (list) --

            A list of VPC security groups IDs.

            • (string) --
          • VpcId (string) --

            The ID of the VPC.

        • DeadLetterConfig (dict) --

          The function's dead letter queue.

          • TargetArn (string) --

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment (dict) --

          The function's environment variables.

          • Variables (dict) --

            Environment variable key-value pairs.

            • (string) --
              • (string) --
          • Error (dict) --

            Error messages for environment variables that couldn't be applied.

            • ErrorCode (string) --

              The error code.

            • Message (string) --

              The error message.

        • KMSKeyArn (string) --

          The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

        • TracingConfig (dict) --

          The function's AWS X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers .

          • (dict) --

            An AWS Lambda layer .

            • Arn (string) --

              The Amazon Resource Name (ARN) of the function layer.

            • CodeSize (integer) --

              The size of the layer archive in bytes.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListLayerVersions
paginator = client.get_paginator('list_layer_versions')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_layer_versions().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    LayerName='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • CompatibleRuntime (string) -- A runtime identifier. For example, go1.x .
  • LayerName (string) --

    [REQUIRED]

    The name or Amazon Resource Name (ARN) of the layer.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'LayerVersions': [
        {
            'LayerVersionArn': 'string',
            'Version': 123,
            'Description': 'string',
            'CreatedDate': 'string',
            'CompatibleRuntimes': [
                'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            ],
            'LicenseInfo': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • LayerVersions (list) --

      A list of versions.

      • (dict) --

        Details about a version of an AWS Lambda layer .

        • LayerVersionArn (string) --

          The ARN of the layer version.

        • Version (integer) --

          The version number.

        • Description (string) --

          The description of the version.

        • CreatedDate (string) --

          The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000 .

        • CompatibleRuntimes (list) --

          The layer's compatible runtimes.

          • (string) --
        • LicenseInfo (string) --

          The layer's open-source license.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListLayers
paginator = client.get_paginator('list_layers')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_layers().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • CompatibleRuntime (string) -- A runtime identifier. For example, go1.x .
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Layers': [
        {
            'LayerName': 'string',
            'LayerArn': 'string',
            'LatestMatchingVersion': {
                'LayerVersionArn': 'string',
                'Version': 123,
                'Description': 'string',
                'CreatedDate': 'string',
                'CompatibleRuntimes': [
                    'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
                ],
                'LicenseInfo': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Layers (list) --

      A list of function layers.

      • (dict) --

        Details about an AWS Lambda layer .

        • LayerName (string) --

          The name of the layer.

        • LayerArn (string) --

          The Amazon Resource Name (ARN) of the function layer.

        • LatestMatchingVersion (dict) --

          The newest version of the layer.

          • LayerVersionArn (string) --

            The ARN of the layer version.

          • Version (integer) --

            The version number.

          • Description (string) --

            The description of the version.

          • CreatedDate (string) --

            The date that the version was created, in ISO 8601 format. For example, 2018-11-27T15:10:45.123+0000 .

          • CompatibleRuntimes (list) --

            The layer's compatible runtimes.

            • (string) --
          • LicenseInfo (string) --

            The layer's open-source license.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListVersionsByFunction
paginator = client.get_paginator('list_versions_by_function')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Lambda.Client.list_versions_by_function().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    FunctionName='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function name - MyFunction .
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction .
    • Partial ARN - 123456789012:function:MyFunction .

    The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    'Versions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'java8'|'python2.7'|'python3.6'|'python3.7'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'provided',
            'Role': 'string',
            'Handler': 'string',
            'CodeSize': 123,
            'Description': 'string',
            'Timeout': 123,
            'MemorySize': 123,
            'LastModified': 'string',
            'CodeSha256': 'string',
            'Version': 'string',
            'VpcConfig': {
                'SubnetIds': [
                    'string',
                ],
                'SecurityGroupIds': [
                    'string',
                ],
                'VpcId': 'string'
            },
            'DeadLetterConfig': {
                'TargetArn': 'string'
            },
            'Environment': {
                'Variables': {
                    'string': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'KMSKeyArn': 'string',
            'TracingConfig': {
                'Mode': 'Active'|'PassThrough'
            },
            'MasterArn': 'string',
            'RevisionId': 'string',
            'Layers': [
                {
                    'Arn': 'string',
                    'CodeSize': 123
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Versions (list) --

      A list of Lambda function versions.

      • (dict) --

        Details about a function's configuration.

        • FunctionName (string) --

          The name of the function.

        • FunctionArn (string) --

          The function's Amazon Resource Name (ARN).

        • Runtime (string) --

          The runtime environment for the Lambda function.

        • Role (string) --

          The function's execution role.

        • Handler (string) --

          The function that Lambda calls to begin executing your function.

        • CodeSize (integer) --

          The size of the function's deployment package, in bytes.

        • Description (string) --

          The function's description.

        • Timeout (integer) --

          The amount of time that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The memory that's allocated to the function.

        • LastModified (string) --

          The date and time that the function was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • CodeSha256 (string) --

          The SHA256 hash of the function's deployment package.

        • Version (string) --

          The version of the Lambda function.

        • VpcConfig (dict) --

          The function's networking configuration.

          • SubnetIds (list) --

            A list of VPC subnet IDs.

            • (string) --
          • SecurityGroupIds (list) --

            A list of VPC security groups IDs.

            • (string) --
          • VpcId (string) --

            The ID of the VPC.

        • DeadLetterConfig (dict) --

          The function's dead letter queue.

          • TargetArn (string) --

            The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic.

        • Environment (dict) --

          The function's environment variables.

          • Variables (dict) --

            Environment variable key-value pairs.

            • (string) --
              • (string) --
          • Error (dict) --

            Error messages for environment variables that couldn't be applied.

            • ErrorCode (string) --

              The error code.

            • Message (string) --

              The error message.

        • KMSKeyArn (string) --

          The KMS key that's used to encrypt the function's environment variables. This key is only returned if you've configured a customer-managed CMK.

        • TracingConfig (dict) --

          The function's AWS X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

          For Lambda@Edge functions, the ARN of the master function.

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers .

          • (dict) --

            An AWS Lambda layer .

            • Arn (string) --

              The Amazon Resource Name (ARN) of the function layer.

            • CodeSize (integer) --

              The size of the layer archive in bytes.

    • NextToken (string) --

      A token to resume pagination.

Waiters

The available waiters are:

class Lambda.Waiter.FunctionExists
waiter = client.get_waiter('function_exists')
wait(**kwargs)

Polls Lambda.Client.get_function() every 1 seconds until a successful state is reached. An error is returned after 20 failed checks.

See also: AWS API Documentation

Request Syntax

waiter.wait(
    FunctionName='string',
    Qualifier='string',
    WaiterConfig={
        'Delay': 123,
        'MaxAttempts': 123
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function, version, or alias.

    Name formats
    • Function name - my-function (name-only), my-function:v1 (with alias).
    • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN - 123456789012:function:my-function .

    You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

  • Qualifier (string) -- Specify a version or alias to get details about a published version of the function.
  • WaiterConfig (dict) --

    A dictionary that provides parameters to control waiting behavior.

    • Delay (integer) --

      The amount of time in seconds to wait between attempts. Default: 1

    • MaxAttempts (integer) --

      The maximum number of attempts to be made. Default: 20

Returns

None