Lambda

Table of Contents

Client

class Lambda.Client

A low-level client representing AWS Lambda

Overview

Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code on a high-availability compute infrastructure and performs all of the administration of the compute resources, including server and operating system maintenance, capacity provisioning and automatic scaling, code monitoring and logging. With Lambda, you can run code for virtually any type of application or backend service. For more information about the Lambda service, see What is Lambda in the Lambda Developer Guide .

The Lambda API Reference provides information about each of the API methods, including details about the parameters in each API request and response.

You can use Software Development Kits (SDKs), Integrated Development Environment (IDE) Toolkits, and command line tools to access the API. For installation instructions, see Tools for Amazon Web Services.

For a list of Region-specific endpoints that Lambda supports, see Lambda endpoints and quotas in the Amazon Web Services General Reference. .

When making the API calls, you will need to authenticate your request by providing a signature. Lambda supports signature version 4. For more information, see Signature Version 4 signing process in the Amazon Web Services General Reference. .

CA certificates

Because Amazon Web Services SDKs use the CA certificates from your computer, changes to the certificates on the Amazon Web Services servers can cause connection failures when you attempt to use an SDK. You can prevent these failures by keeping your computer's CA certificates and operating system up-to-date. If you encounter this issue in a corporate environment and do not manage your own computer, you might need to ask an administrator to assist with the update process. The following list shows minimum operating system and Java versions:

  • Microsoft Windows versions that have updates from January 2005 or later installed contain at least one of the required CAs in their trust list.
  • Mac OS X 10.4 with Java for Mac OS X 10.4 Release 5 (February 2007), Mac OS X 10.5 (October 2007), and later versions contain at least one of the required CAs in their trust list.
  • Red Hat Enterprise Linux 5 (March 2007), 6, and 7 and CentOS 5, 6, and 7 all contain at least one of the required CAs in their default trusted CA list.
  • Java 1.4.2_12 (May 2006), 5 Update 2 (March 2005), and all later versions, including Java 6 (December 2006), 7, and 8, contain at least one of the required CAs in their default trusted CA list.

When accessing the Lambda management console or Lambda API endpoints, whether through browsers or programmatically, you will need to ensure your client machines support any of the following CAs:

  • Amazon Root CA 1
  • Starfield Services Root Certificate Authority - G2
  • Starfield Class 2 Certification Authority

Root certificates from the first two authorities are available from Amazon trust services, but keeping your computer up-to-date is the more straightforward solution. To learn more about ACM-provided certificates, see Amazon Web Services Certificate Manager FAQs.

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 Lambda layer. Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all accounts in an organization, or all Amazon Web Services accounts.

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 layer usage permission to all accounts in an organization, or all Amazon Web Services accounts (if organizationId is not specified). For the last case, make sure that you really do want all Amazon Web Services accounts to have usage permission to this layer.

  • 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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.PolicyLengthExceededException
  • Lambda.Client.exceptions.PreconditionFailedException

Examples

The following example grants permission for the account 223456789012 to use version 1 of a layer named my-layer.

response = client.add_layer_version_permission(
    Action='lambda:GetLayerVersion',
    LayerName='my-layer',
    Principal='223456789012',
    StatementId='xaccount',
    VersionNumber=1,
)

print(response)

Expected Output:

{
    'RevisionId': '35d87451-f796-4a3f-a618-95a3671b0a0c',
    'Statement': '{"Sid":"xaccount","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::223456789012:root"},"Action":"lambda:GetLayerVersion","Resource":"arn:aws:lambda:us-east-2:123456789012:layer:my-layer:1"}',
    'ResponseMetadata': {
        '...': '...',
    },
}
add_permission(**kwargs)

Grants an Amazon Web Service, Amazon Web Services account, or Amazon Web Services organization 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. Note: Lambda does not support adding policies to version $LATEST.

To grant permission to another account, specify the account ID as the Principal . To grant permission to an organization defined in Organizations, specify the organization ID as the PrincipalOrgID . For Amazon Web Services, the principal is a domain-style identifier that the service defines, such as s3.amazonaws.com or sns.amazonaws.com . For Amazon Web Services, you can also specify the ARN of the associated resource as the SourceArn . 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 operation adds a statement to a resource-based permissions policy for the function. For more information about function policies, see Using resource-based policies for Lambda.

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',
    PrincipalOrgID='string',
    FunctionUrlAuthType='NONE'|'AWS_IAM'
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

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

    Name formats
    • Function namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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 Amazon Web Service or Amazon Web Services 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 Amazon Web Services, the ARN of the Amazon Web Services resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.

    Note that Lambda configures the comparison using the StringLike operator.

  • SourceAccount (string) -- For Amazon Web Service, the ID of the Amazon Web Services account that owns the resource. Use this together with SourceArn to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account.
  • EventSourceToken (string) -- For Alexa Smart Home functions, a token that the invoker must supply.
  • Qualifier (string) -- Specify a version or alias to add permissions to a published version of the function.
  • RevisionId (string) -- Update the policy only 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.
  • PrincipalOrgID (string) -- The identifier for your organization in Organizations. Use this to grant permissions to all the Amazon Web Services accounts under this organization.
  • FunctionUrlAuthType (string) -- The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.
Return type

dict

Returns

Response Syntax

{
    'Statement': 'string'
}

Response Structure

  • (dict) --

    • Statement (string) --

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.PolicyLengthExceededException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.PreconditionFailedException

Examples

The following example adds permission for Amazon S3 to invoke a Lambda function named my-function for notifications from a bucket named my-bucket-1xpuxmplzrlbh in account 123456789012.

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

print(response)

Expected Output:

{
    'Statement': '{"Sid":"s3","Effect":"Allow","Principal":{"Service":"s3.amazonaws.com"},"Action":"lambda:InvokeFunction","Resource":"arn:aws:lambda:us-east-2:123456789012:function:my-function","Condition":{"StringEquals":{"AWS:SourceAccount":"123456789012"},"ArnLike":{"AWS:SourceArn":"arn:aws:s3:::my-bucket-1xpuxmplzrlbh"}}}',
    'ResponseMetadata': {
        '...': '...',
    },
}

The following example adds permission for account 223456789012 invoke a Lambda function named my-function.

response = client.add_permission(
    Action='lambda:InvokeFunction',
    FunctionName='my-function',
    Principal='223456789012',
    StatementId='xaccount',
)

print(response)

Expected Output:

{
    'Statement': '{"Sid":"xaccount","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::223456789012:root"},"Action":"lambda:InvokeFunction","Resource":"arn:aws:lambda:us-east-2:123456789012:function:my-function"}',
    '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.
close()

Closes underlying endpoint connections.

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 second version, 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 second version, and the percentage of traffic that's routed to it.

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

      A unique identifier that changes when you update the alias.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example creates an alias named LIVE that points to version 1 of the my-function Lambda function.

response = client.create_alias(
    Description='alias for live version of function',
    FunctionName='my-function',
    FunctionVersion='1',
    Name='LIVE',
)

print(response)

Expected Output:

{
    'AliasArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:LIVE',
    'Description': 'alias for live version of function',
    'FunctionVersion': '1',
    'Name': 'LIVE',
    'RevisionId': '873282ed-xmpl-4dc8-a069-d0c647e470c6',
    'ResponseMetadata': {
        '...': '...',
    },
}
create_code_signing_config(**kwargs)

Creates a code signing configuration. A code signing configuration defines a list of allowed signing profiles and defines the code-signing validation policy (action to be taken if deployment validation checks fail).

See also: AWS API Documentation

Request Syntax

response = client.create_code_signing_config(
    Description='string',
    AllowedPublishers={
        'SigningProfileVersionArns': [
            'string',
        ]
    },
    CodeSigningPolicies={
        'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
    }
)
Parameters
  • Description (string) -- Descriptive name for this code signing configuration.
  • AllowedPublishers (dict) --

    [REQUIRED]

    Signing profiles for this code signing configuration.

    • SigningProfileVersionArns (list) -- [REQUIRED]

      The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

      • (string) --
  • CodeSigningPolicies (dict) --

    The code signing policies define the actions to take if the validation checks fail.

    • UntrustedArtifactOnDeployment (string) --

      Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

      Default value: Warn

Return type

dict

Returns

Response Syntax

{
    'CodeSigningConfig': {
        'CodeSigningConfigId': 'string',
        'CodeSigningConfigArn': 'string',
        'Description': 'string',
        'AllowedPublishers': {
            'SigningProfileVersionArns': [
                'string',
            ]
        },
        'CodeSigningPolicies': {
            'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
        },
        'LastModified': 'string'
    }
}

Response Structure

  • (dict) --

    • CodeSigningConfig (dict) --

      The code signing configuration.

      • CodeSigningConfigId (string) --

        Unique identifer for the Code signing configuration.

      • CodeSigningConfigArn (string) --

        The Amazon Resource Name (ARN) of the Code signing configuration.

      • Description (string) --

        Code signing configuration description.

      • AllowedPublishers (dict) --

        List of allowed publishers.

        • SigningProfileVersionArns (list) --

          The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

          • (string) --
      • CodeSigningPolicies (dict) --

        The code signing policy controls the validation failure action for signature mismatch or expiry.

        • UntrustedArtifactOnDeployment (string) --

          Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

          Default value: Warn

      • LastModified (string) --

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
create_event_source_mapping(**kwargs)

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

For details about how to configure different event sources, see the following topics.

The following error handling options are available only for stream sources (DynamoDB and Kinesis):

  • BisectBatchOnFunctionError - If the function returns an error, split the batch in two and retry.
  • DestinationConfig - Send discarded records to an Amazon SQS queue or Amazon SNS topic.
  • MaximumRecordAgeInSeconds - Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires
  • MaximumRetryAttempts - Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.
  • ParallelizationFactor - Process multiple batches from each shard concurrently.

For information about which configuration parameters apply to each event source, 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,
    FilterCriteria={
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    MaximumBatchingWindowInSeconds=123,
    ParallelizationFactor=123,
    StartingPosition='TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    StartingPositionTimestamp=datetime(2015, 1, 1),
    DestinationConfig={
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    MaximumRecordAgeInSeconds=123,
    BisectBatchOnFunctionError=True|False,
    MaximumRetryAttempts=123,
    TumblingWindowInSeconds=123,
    Topics=[
        'string',
    ],
    Queues=[
        'string',
    ],
    SourceAccessConfigurations=[
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    SelfManagedEventSource={
        'Endpoints': {
            'string': [
                'string',
            ]
        }
    },
    FunctionResponseTypes=[
        'ReportBatchItemFailures',
    ],
    AmazonManagedKafkaEventSourceConfig={
        'ConsumerGroupId': 'string'
    },
    SelfManagedKafkaEventSourceConfig={
        'ConsumerGroupId': '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.
    • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.
    • Amazon MQ - The ARN of the broker.
  • 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) --

    When true, the event source mapping is active. When false, Lambda pauses polling and invocation.

    Default: True

  • BatchSize (integer) --

    The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

    • Amazon Kinesis - Default 100. Max 10,000.
    • Amazon DynamoDB Streams - Default 100. Max 10,000.
    • Amazon Simple Queue Service - Default 10. For standard queues the max is 10,000. For FIFO queues the max is 10.
    • Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000.
    • Self-managed Apache Kafka - Default 100. Max 10,000.
    • Amazon MQ (ActiveMQ and RabbitMQ) - Default 100. Max 10,000.
  • FilterCriteria (dict) --

    An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

    • Filters (list) --

      A list of filters.

      • (dict) --

        A structure within a FilterCriteria object that defines an event filtering pattern.

        • Pattern (string) --

          A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

  • MaximumBatchingWindowInSeconds (integer) --

    The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

    For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

    Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

  • ParallelizationFactor (integer) -- (Streams only) The number of batches to process from each shard concurrently.
  • StartingPosition (string) -- The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.
  • StartingPositionTimestamp (datetime) -- With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.
  • DestinationConfig (dict) --

    (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

    • OnSuccess (dict) --

      The destination configuration for successful invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

    • OnFailure (dict) --

      The destination configuration for failed invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

  • MaximumRecordAgeInSeconds (integer) -- (Streams only) Discard records older than the specified age. The default value is infinite (-1).
  • BisectBatchOnFunctionError (boolean) -- (Streams only) If the function returns an error, split the batch in two and retry.
  • MaximumRetryAttempts (integer) -- (Streams only) Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.
  • TumblingWindowInSeconds (integer) -- (Streams only) The duration in seconds of a processing window. The range is between 1 second and 900 seconds.
  • Topics (list) --

    The name of the Kafka topic.

    • (string) --
  • Queues (list) --

    (MQ) The name of the Amazon MQ broker destination queue to consume.

    • (string) --
  • SourceAccessConfigurations (list) --

    An array of authentication protocols or VPC components required to secure your event source.

    • (dict) --

      To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

      • Type (string) --

        The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

        • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
        • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
        • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
        • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
        • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
        • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
        • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
        • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
        • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
      • URI (string) --

        The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

  • SelfManagedEventSource (dict) --

    The self-managed Apache Kafka cluster to receive records from.

    • Endpoints (dict) --

      The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

      • (string) --
        • (list) --
          • (string) --
  • FunctionResponseTypes (list) --

    (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

    • (string) --
  • AmazonManagedKafkaEventSourceConfig (dict) --

    Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

    • ConsumerGroupId (string) --

      The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

  • SelfManagedKafkaEventSourceConfig (dict) --

    Specific configuration settings for a self-managed Apache Kafka event source.

    • ConsumerGroupId (string) --

      The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Return type

dict

Returns

Response Syntax

{
    'UUID': 'string',
    'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    'StartingPositionTimestamp': datetime(2015, 1, 1),
    'BatchSize': 123,
    'MaximumBatchingWindowInSeconds': 123,
    'ParallelizationFactor': 123,
    'EventSourceArn': 'string',
    'FilterCriteria': {
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string',
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    'Topics': [
        'string',
    ],
    'Queues': [
        'string',
    ],
    'SourceAccessConfigurations': [
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    'SelfManagedEventSource': {
        'Endpoints': {
            'string': [
                'string',
            ]
        }
    },
    'MaximumRecordAgeInSeconds': 123,
    'BisectBatchOnFunctionError': True|False,
    'MaximumRetryAttempts': 123,
    'TumblingWindowInSeconds': 123,
    'FunctionResponseTypes': [
        'ReportBatchItemFailures',
    ],
    'AmazonManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    },
    'SelfManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    }
}

Response Structure

  • (dict) --

    A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

    • UUID (string) --

      The identifier of the event source mapping.

    • StartingPosition (string) --

      The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

    • StartingPositionTimestamp (datetime) --

      With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

    • BatchSize (integer) --

      The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

      Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

      Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • MaximumBatchingWindowInSeconds (integer) --

      The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

      For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

      Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • ParallelizationFactor (integer) --

      (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

    • EventSourceArn (string) --

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

    • FilterCriteria (dict) --

      An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

      • Filters (list) --

        A list of filters.

        • (dict) --

          A structure within a FilterCriteria object that defines an event filtering pattern.

          • Pattern (string) --

            A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated or that its state changed.

    • LastProcessingResult (string) --

      The result of the last Lambda invocation of your 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) --

      Indicates whether a user or Lambda made the last change to the event source mapping.

    • DestinationConfig (dict) --

      (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

    • Topics (list) --

      The name of the Kafka topic.

      • (string) --
    • Queues (list) --

      (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

      • (string) --
    • SourceAccessConfigurations (list) --

      An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

      • (dict) --

        To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

        • Type (string) --

          The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

          • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
          • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
          • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
          • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
          • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
          • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
          • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
          • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
          • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
        • URI (string) --

          The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

    • SelfManagedEventSource (dict) --

      The self-managed Apache Kafka cluster for your event source.

      • Endpoints (dict) --

        The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

        • (string) --
          • (list) --
            • (string) --
    • MaximumRecordAgeInSeconds (integer) --

      (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

    • BisectBatchOnFunctionError (boolean) --

      (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

    • MaximumRetryAttempts (integer) --

      (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

    • TumblingWindowInSeconds (integer) --

      (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

    • FunctionResponseTypes (list) --

      (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

      • (string) --
    • AmazonManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

    • SelfManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for a self-managed Apache Kafka event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceNotFoundException

Examples

The following example creates a mapping between an SQS queue and the my-function Lambda function.

response = client.create_event_source_mapping(
    BatchSize=5,
    EventSourceArn='arn:aws:sqs:us-west-2:123456789012:my-queue',
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'BatchSize': 5,
    'EventSourceArn': 'arn:aws:sqs:us-west-2:123456789012:my-queue',
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
    'LastModified': 1569284520.333,
    'State': 'Creating',
    'StateTransitionReason': 'USER_INITIATED',
    'UUID': 'a1b2c3d4-5678-90ab-cdef-11111EXAMPLE',
    'ResponseMetadata': {
        '...': '...',
    },
}
create_function(**kwargs)

Creates a Lambda function. To create a function, you need a deployment package and an execution role. The deployment package is a .zip file archive or container image that contains your function code. The execution role grants the function permission to use Amazon Web Services, such as Amazon CloudWatch Logs for log streaming and X-Ray for request tracing.

If the deployment package is a container image, then you set the package type to Image . For a container image, the code property must include the URI of a container image in the Amazon ECR registry. You do not need to specify the handler and runtime properties.

If the deployment package is a .zip file archive, then you set the package type to Zip . For a .zip file archive, the code property specifies the location of the .zip file. You must also specify the handler and runtime properties. The code in the deployment package must be compatible with the target instruction set architecture of the function ( x86-64 or arm64 ). If you do not specify the architecture, then the default value is x86-64 .

When you create a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute or so. During this time, you can't invoke or modify the function. The State , StateReason , and StateReasonCode fields in the response from GetFunctionConfiguration indicate when the function is ready to invoke. For more information, see Lambda function states.

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 ).

You can use code signing if your deployment package is a .zip file archive. To enable code signing for this function, specify the ARN of a code-signing configuration. When a user attempts to deploy a code package with UpdateFunctionCode, Lambda checks that the code package has a valid signature from a trusted publisher. The code-signing configuration includes set of signing profiles, which define the trusted publishers for this function.

If another Amazon Web Services account or an Amazon Web Service invokes your function, use AddPermission to grant permission by creating a resource-based Identity and Access Management (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 Amazon Web Services, create an event source mapping ( CreateEventSourceMapping ), or configure a function trigger in the other service. For more information, see Invoking Lambda functions.

See also: AWS API Documentation

Request Syntax

response = client.create_function(
    FunctionName='string',
    Runtime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    Role='string',
    Handler='string',
    Code={
        'ZipFile': b'bytes',
        'S3Bucket': 'string',
        'S3Key': 'string',
        'S3ObjectVersion': 'string',
        'ImageUri': 'string'
    },
    Description='string',
    Timeout=123,
    MemorySize=123,
    Publish=True|False,
    VpcConfig={
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ]
    },
    PackageType='Zip'|'Image',
    DeadLetterConfig={
        'TargetArn': 'string'
    },
    Environment={
        'Variables': {
            'string': 'string'
        }
    },
    KMSKeyArn='string',
    TracingConfig={
        'Mode': 'Active'|'PassThrough'
    },
    Tags={
        'string': 'string'
    },
    Layers=[
        'string',
    ],
    FileSystemConfigs=[
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    ImageConfig={
        'EntryPoint': [
            'string',
        ],
        'Command': [
            'string',
        ],
        'WorkingDirectory': 'string'
    },
    CodeSigningConfigArn='string',
    Architectures=[
        'x86_64'|'arm64',
    ],
    EphemeralStorage={
        'Size': 123
    },
    SnapStart={
        'ApplyOn': 'PublishedVersions'|'None'
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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) -- The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive.
  • Role (string) --

    [REQUIRED]

    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 run your function. Handler is required if the deployment package is a .zip file archive. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Lambda programming model.
  • Code (dict) --

    [REQUIRED]

    The code for the function.

    • ZipFile (bytes) --

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

    • S3Bucket (string) --

      An Amazon S3 bucket in the same Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services 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.

    • ImageUri (string) --

      URI of a container image in the Amazon ECR registry.

  • Description (string) -- A description of the function.
  • Timeout (integer) -- The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds. For more information, see Lambda execution environment.
  • MemorySize (integer) -- The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB.
  • Publish (boolean) -- Set to true to publish the first version of the function during creation.
  • VpcConfig (dict) --

    For network connectivity to Amazon Web Services 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 access resources and the internet only through that VPC. For more information, see Configuring a Lambda function to access resources in a VPC.

    • SubnetIds (list) --

      A list of VPC subnet IDs.

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

      A list of VPC security group IDs.

      • (string) --
  • PackageType (string) -- The type of deployment package. Set to Image for container image and set to Zip for .zip file archive.
  • 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.

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

    Set Mode to Active to sample and trace a subset of incoming requests with 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) --
  • FileSystemConfigs (list) --

    Connection settings for an Amazon EFS file system.

    • (dict) --

      Details about the connection between a Lambda function and an Amazon EFS file system.

      • Arn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

      • LocalMountPath (string) -- [REQUIRED]

        The path where the function can access the file system, starting with /mnt/ .

  • ImageConfig (dict) --

    Container image configuration values that override the values in the container image Dockerfile.

    • EntryPoint (list) --

      Specifies the entry point to their application, which is typically the location of the runtime executable.

      • (string) --
    • Command (list) --

      Specifies parameters that you want to pass in with ENTRYPOINT.

      • (string) --
    • WorkingDirectory (string) --

      Specifies the working directory.

  • CodeSigningConfigArn (string) -- To enable code signing for this function, specify the ARN of a code-signing configuration. A code-signing configuration includes a set of signing profiles, which define the trusted publishers for this function.
  • Architectures (list) --

    The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value is x86_64 .

    • (string) --
  • EphemeralStorage (dict) --

    The size of the function's /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB.

    • Size (integer) -- [REQUIRED]

      The size of the function's /tmp directory.

  • SnapStart (dict) --

    The function's SnapStart setting.

    • ApplyOn (string) --

      Set to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version.

Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    '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,
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string'
        },
    ],
    'State': 'Pending'|'Active'|'Inactive'|'Failed',
    'StateReason': 'string',
    'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
    'LastUpdateStatusReason': 'string',
    'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'FileSystemConfigs': [
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    'PackageType': 'Zip'|'Image',
    'ImageConfigResponse': {
        'ImageConfig': {
            'EntryPoint': [
                'string',
            ],
            'Command': [
                'string',
            ],
            'WorkingDirectory': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'SigningProfileVersionArn': 'string',
    'SigningJobArn': 'string',
    'Architectures': [
        'x86_64'|'arm64',
    ],
    'EphemeralStorage': {
        'Size': 123
    },
    'SnapStart': {
        'ApplyOn': 'PublishedVersions'|'None',
        'OptimizationStatus': 'On'|'Off'
    }
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The amount of memory available to the function at runtime.

    • 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 group 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. Omitted from CloudTrail logs.

      • Variables (dict) --

        Environment variable key-value pairs. Omitted from CloudTrail logs.

        • (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 returned only if you've configured a customer managed key.

    • TracingConfig (dict) --

      The function's X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

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

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers.

      • (dict) --

        An Lambda layer.

        • Arn (string) --

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

        • CodeSize (integer) --

          The size of the layer archive in bytes.

        • SigningProfileVersionArn (string) --

          The Amazon Resource Name (ARN) for a signing profile version.

        • SigningJobArn (string) --

          The Amazon Resource Name (ARN) of a signing job.

    • State (string) --

      The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

    • StateReason (string) --

      The reason for the function's current state.

    • StateReasonCode (string) --

      The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

    • LastUpdateStatus (string) --

      The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

    • LastUpdateStatusReason (string) --

      The reason for the last update that was performed on the function.

    • LastUpdateStatusReasonCode (string) --

      The reason code for the last update that was performed on the function.

    • FileSystemConfigs (list) --

      Connection settings for an Amazon EFS file system.

      • (dict) --

        Details about the connection between a Lambda function and an Amazon EFS file system.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

        • LocalMountPath (string) --

          The path where the function can access the file system, starting with /mnt/ .

    • PackageType (string) --

      The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

    • ImageConfigResponse (dict) --

      The function's image configuration values.

      • ImageConfig (dict) --

        Configuration values that override the container image Dockerfile.

        • EntryPoint (list) --

          Specifies the entry point to their application, which is typically the location of the runtime executable.

          • (string) --
        • Command (list) --

          Specifies parameters that you want to pass in with ENTRYPOINT.

          • (string) --
        • WorkingDirectory (string) --

          Specifies the working directory.

      • Error (dict) --

        Error response to GetFunctionConfiguration .

        • ErrorCode (string) --

          Error code.

        • Message (string) --

          Error message.

    • SigningProfileVersionArn (string) --

      The ARN of the signing profile version.

    • SigningJobArn (string) --

      The ARN of the signing job.

    • Architectures (list) --

      The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

      • (string) --
    • EphemeralStorage (dict) --

      The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

      • Size (integer) --

        The size of the function's /tmp directory.

    • SnapStart (dict) --

      Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

      • ApplyOn (string) --

        When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

      • OptimizationStatus (string) --

        When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.CodeStorageExceededException
  • Lambda.Client.exceptions.CodeVerificationFailedException
  • Lambda.Client.exceptions.InvalidCodeSignatureException
  • Lambda.Client.exceptions.CodeSigningConfigNotFoundException

Examples

The following example creates a function with a deployment package in Amazon S3 and enables X-Ray tracing and environment variable encryption.

response = client.create_function(
    Code={
        'S3Bucket': 'my-bucket-1xpuxmplzrlbh',
        'S3Key': 'function.zip',
    },
    Description='Process image objects from Amazon S3.',
    Environment={
        'Variables': {
            'BUCKET': 'my-bucket-1xpuxmplzrlbh',
            'PREFIX': 'inbound',
        },
    },
    FunctionName='my-function',
    Handler='index.handler',
    KMSKeyArn='arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
    MemorySize=256,
    Publish=True,
    Role='arn:aws:iam::123456789012:role/lambda-role',
    Runtime='nodejs12.x',
    Tags={
        'DEPARTMENT': 'Assets',
    },
    Timeout=15,
    TracingConfig={
        'Mode': 'Active',
    },
)

print(response)

Expected Output:

{
    'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
    'CodeSize': 5797206,
    'Description': 'Process image objects from Amazon S3.',
    'Environment': {
        'Variables': {
            'BUCKET': 'my-bucket-1xpuxmplzrlbh',
            'PREFIX': 'inbound',
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
    'FunctionName': 'my-function',
    'Handler': 'index.handler',
    'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
    'LastModified': '2020-04-10T19:06:32.563+0000',
    'LastUpdateStatus': 'Successful',
    'MemorySize': 256,
    'RevisionId': 'b75dcd81-xmpl-48a8-a75a-93ba8b5b9727',
    'Role': 'arn:aws:iam::123456789012:role/lambda-role',
    'Runtime': 'nodejs12.x',
    'State': 'Active',
    'Timeout': 15,
    'TracingConfig': {
        'Mode': 'Active',
    },
    'Version': '1',
    'ResponseMetadata': {
        '...': '...',
    },
}
create_function_url_config(**kwargs)

Creates a Lambda function URL with the specified configuration parameters. A function URL is a dedicated HTTP(S) endpoint that you can use to invoke your function.

See also: AWS API Documentation

Request Syntax

response = client.create_function_url_config(
    FunctionName='string',
    Qualifier='string',
    AuthType='NONE'|'AWS_IAM',
    Cors={
        'AllowCredentials': True|False,
        'AllowHeaders': [
            'string',
        ],
        'AllowMethods': [
            'string',
        ],
        'AllowOrigins': [
            'string',
        ],
        'ExposeHeaders': [
            'string',
        ],
        'MaxAge': 123
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) -- The alias name.
  • AuthType (string) --

    [REQUIRED]

    The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

  • Cors (dict) --

    The cross-origin resource sharing (CORS) settings for your function URL.

    • AllowCredentials (boolean) --

      Whether to allow cookies or other credentials in requests to your function URL. The default is false .

    • AllowHeaders (list) --

      The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

      • (string) --
    • AllowMethods (list) --

      The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

      • (string) --
    • AllowOrigins (list) --

      The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

      Alternatively, you can grant access to all origins using the wildcard character ( * ).

      • (string) --
    • ExposeHeaders (list) --

      The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

      • (string) --
    • MaxAge (integer) --

      The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

Return type

dict

Returns

Response Syntax

{
    'FunctionUrl': 'string',
    'FunctionArn': 'string',
    'AuthType': 'NONE'|'AWS_IAM',
    'Cors': {
        'AllowCredentials': True|False,
        'AllowHeaders': [
            'string',
        ],
        'AllowMethods': [
            'string',
        ],
        'AllowOrigins': [
            'string',
        ],
        'ExposeHeaders': [
            'string',
        ],
        'MaxAge': 123
    },
    'CreationTime': 'string'
}

Response Structure

  • (dict) --

    • FunctionUrl (string) --

      The HTTP URL endpoint for your function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of your function.

    • AuthType (string) --

      The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

    • Cors (dict) --

      The cross-origin resource sharing (CORS) settings for your function URL.

      • AllowCredentials (boolean) --

        Whether to allow cookies or other credentials in requests to your function URL. The default is false .

      • AllowHeaders (list) --

        The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • AllowMethods (list) --

        The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

        • (string) --
      • AllowOrigins (list) --

        The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

        Alternatively, you can grant access to all origins using the wildcard character ( * ).

        • (string) --
      • ExposeHeaders (list) --

        The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • MaxAge (integer) --

        The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

    • CreationTime (string) --

      When the function URL was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

Exceptions

  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException
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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example deletes an alias named BLUE from a function named my-function

response = client.delete_alias(
    FunctionName='my-function',
    Name='BLUE',
)

print(response)

Expected Output:

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

Deletes the code signing configuration. You can delete the code signing configuration only if no function is using it.

See also: AWS API Documentation

Request Syntax

response = client.delete_code_signing_config(
    CodeSigningConfigArn='string'
)
Parameters
CodeSigningConfigArn (string) --

[REQUIRED]

The The Amazon Resource Name (ARN) of the code signing configuration.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
delete_event_source_mapping(**kwargs)

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

When you delete an event source mapping, it enters a Deleting state and might not be completely deleted for several seconds.

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',
    'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    'StartingPositionTimestamp': datetime(2015, 1, 1),
    'BatchSize': 123,
    'MaximumBatchingWindowInSeconds': 123,
    'ParallelizationFactor': 123,
    'EventSourceArn': 'string',
    'FilterCriteria': {
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string',
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    'Topics': [
        'string',
    ],
    'Queues': [
        'string',
    ],
    'SourceAccessConfigurations': [
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    'SelfManagedEventSource': {
        'Endpoints': {
            'string': [
                'string',
            ]
        }
    },
    'MaximumRecordAgeInSeconds': 123,
    'BisectBatchOnFunctionError': True|False,
    'MaximumRetryAttempts': 123,
    'TumblingWindowInSeconds': 123,
    'FunctionResponseTypes': [
        'ReportBatchItemFailures',
    ],
    'AmazonManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    },
    'SelfManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    }
}

Response Structure

  • (dict) --

    A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

    • UUID (string) --

      The identifier of the event source mapping.

    • StartingPosition (string) --

      The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

    • StartingPositionTimestamp (datetime) --

      With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

    • BatchSize (integer) --

      The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

      Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

      Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • MaximumBatchingWindowInSeconds (integer) --

      The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

      For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

      Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • ParallelizationFactor (integer) --

      (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

    • EventSourceArn (string) --

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

    • FilterCriteria (dict) --

      An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

      • Filters (list) --

        A list of filters.

        • (dict) --

          A structure within a FilterCriteria object that defines an event filtering pattern.

          • Pattern (string) --

            A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated or that its state changed.

    • LastProcessingResult (string) --

      The result of the last Lambda invocation of your 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) --

      Indicates whether a user or Lambda made the last change to the event source mapping.

    • DestinationConfig (dict) --

      (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

    • Topics (list) --

      The name of the Kafka topic.

      • (string) --
    • Queues (list) --

      (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

      • (string) --
    • SourceAccessConfigurations (list) --

      An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

      • (dict) --

        To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

        • Type (string) --

          The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

          • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
          • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
          • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
          • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
          • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
          • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
          • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
          • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
          • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
        • URI (string) --

          The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

    • SelfManagedEventSource (dict) --

      The self-managed Apache Kafka cluster for your event source.

      • Endpoints (dict) --

        The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

        • (string) --
          • (list) --
            • (string) --
    • MaximumRecordAgeInSeconds (integer) --

      (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

    • BisectBatchOnFunctionError (boolean) --

      (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

    • MaximumRetryAttempts (integer) --

      (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

    • TumblingWindowInSeconds (integer) --

      (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

    • FunctionResponseTypes (list) --

      (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

      • (string) --
    • AmazonManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

    • SelfManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for a self-managed Apache Kafka event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceInUseException

Examples

The following example deletes an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.

response = client.delete_event_source_mapping(
    UUID='14e0db71-xmpl-4eb5-b481-8945cf9d10c2',
)

print(response)

Expected Output:

{
    'BatchSize': 5,
    'EventSourceArn': 'arn:aws:sqs:us-west-2:123456789012:my-queue',
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'State': 'Enabled',
    'StateTransitionReason': 'USER_INITIATED',
    'UUID': '14e0db71-xmpl-4eb5-b481-8945cf9d10c2',
    '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 Amazon Web 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 namemy-function (name-only), my-function:1 (with version).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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 an alias references.
Returns

None

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example deletes version 1 of a Lambda function named my-function.

response = client.delete_function(
    FunctionName='my-function',
    Qualifier='1',
)

print(response)

Expected Output:

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

Removes the code signing configuration from the function.

See also: AWS API Documentation

Request Syntax

response = client.delete_function_code_signing_config(
    FunctionName='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.

Returns
None

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.CodeSigningConfigNotFoundException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException
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 namemy-function .
  • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
  • Partial ARN123456789012: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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example deletes the reserved concurrent execution limit from a function named my-function.

response = client.delete_function_concurrency(
    FunctionName='my-function',
)

print(response)

Expected Output:

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

Deletes the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

See also: AWS API Documentation

Request Syntax

response = client.delete_function_event_invoke_config(
    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) -- A version number or alias name.
Returns

None

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example deletes the asynchronous invocation configuration for the GREEN alias of a function named my-function.

response = client.delete_function_event_invoke_config(
    FunctionName='my-function',
    Qualifier='GREEN',
)

print(response)

Expected Output:

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

Deletes a Lambda function URL. When you delete a function URL, you can't recover it. Creating a new function URL results in a different URL address.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) -- The alias name.
Returns

None

Exceptions

  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException
delete_layer_version(**kwargs)

Deletes a version of an 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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example deletes version 2 of a layer named my-layer.

response = client.delete_layer_version(
    LayerName='my-layer',
    VersionNumber=2,
)

print(response)

Expected Output:

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

Deletes the provisioned concurrency configuration for a function.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) --

    [REQUIRED]

    The version number or alias name.

Returns

None

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

The following example deletes the provisioned concurrency configuration for the GREEN alias of a function named my-function.

response = client.delete_provisioned_concurrency_config(
    FunctionName='my-function',
    Qualifier='GREEN',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
get_account_settings()

Retrieves details about your account's limits and usage in an Amazon Web Services 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 a function's deployment package and layers when they're extracted.

      • CodeSizeZipped (integer) --

        The maximum size of a deployment package when it's uploaded directly to 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.

Exceptions

  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

This operation takes no parameters and returns details about storage and concurrency quotas in the current Region.

response = client.get_account_settings(
)

print(response)

Expected Output:

{
    'AccountLimit': {
        'CodeSizeUnzipped': 262144000,
        'CodeSizeZipped': 52428800,
        'ConcurrentExecutions': 1000,
        'TotalCodeSize': 80530636800,
        'UnreservedConcurrentExecutions': 1000,
    },
    'AccountUsage': {
        'FunctionCount': 4,
        'TotalCodeSize': 9426,
    },
    '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 second version, and the percentage of traffic that's routed to it.

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

      A unique identifier that changes when you update the alias.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns details about an alias named BLUE for a function named my-function

response = client.get_alias(
    FunctionName='my-function',
    Name='BLUE',
)

print(response)

Expected Output:

{
    'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:BLUE',
    'Description': 'Production environment BLUE.',
    'FunctionVersion': '3',
    'Name': 'BLUE',
    'RevisionId': '594f41fb-xmpl-4c20-95c7-6ca5f2a92c93',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_code_signing_config(**kwargs)

Returns information about the specified code signing configuration.

See also: AWS API Documentation

Request Syntax

response = client.get_code_signing_config(
    CodeSigningConfigArn='string'
)
Parameters
CodeSigningConfigArn (string) --

[REQUIRED]

The The Amazon Resource Name (ARN) of the code signing configuration.

Return type
dict
Returns
Response Syntax
{
    'CodeSigningConfig': {
        'CodeSigningConfigId': 'string',
        'CodeSigningConfigArn': 'string',
        'Description': 'string',
        'AllowedPublishers': {
            'SigningProfileVersionArns': [
                'string',
            ]
        },
        'CodeSigningPolicies': {
            'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
        },
        'LastModified': 'string'
    }
}

Response Structure

  • (dict) --
    • CodeSigningConfig (dict) --

      The code signing configuration

      • CodeSigningConfigId (string) --

        Unique identifer for the Code signing configuration.

      • CodeSigningConfigArn (string) --

        The Amazon Resource Name (ARN) of the Code signing configuration.

      • Description (string) --

        Code signing configuration description.

      • AllowedPublishers (dict) --

        List of allowed publishers.

        • SigningProfileVersionArns (list) --

          The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

          • (string) --
      • CodeSigningPolicies (dict) --

        The code signing policy controls the validation failure action for signature mismatch or expiry.

        • UntrustedArtifactOnDeployment (string) --

          Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

          Default value: Warn

      • LastModified (string) --

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
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',
    'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    'StartingPositionTimestamp': datetime(2015, 1, 1),
    'BatchSize': 123,
    'MaximumBatchingWindowInSeconds': 123,
    'ParallelizationFactor': 123,
    'EventSourceArn': 'string',
    'FilterCriteria': {
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string',
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    'Topics': [
        'string',
    ],
    'Queues': [
        'string',
    ],
    'SourceAccessConfigurations': [
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    'SelfManagedEventSource': {
        'Endpoints': {
            'string': [
                'string',
            ]
        }
    },
    'MaximumRecordAgeInSeconds': 123,
    'BisectBatchOnFunctionError': True|False,
    'MaximumRetryAttempts': 123,
    'TumblingWindowInSeconds': 123,
    'FunctionResponseTypes': [
        'ReportBatchItemFailures',
    ],
    'AmazonManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    },
    'SelfManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    }
}

Response Structure

  • (dict) --

    A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

    • UUID (string) --

      The identifier of the event source mapping.

    • StartingPosition (string) --

      The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

    • StartingPositionTimestamp (datetime) --

      With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

    • BatchSize (integer) --

      The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

      Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

      Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • MaximumBatchingWindowInSeconds (integer) --

      The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

      For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

      Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • ParallelizationFactor (integer) --

      (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

    • EventSourceArn (string) --

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

    • FilterCriteria (dict) --

      An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

      • Filters (list) --

        A list of filters.

        • (dict) --

          A structure within a FilterCriteria object that defines an event filtering pattern.

          • Pattern (string) --

            A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated or that its state changed.

    • LastProcessingResult (string) --

      The result of the last Lambda invocation of your 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) --

      Indicates whether a user or Lambda made the last change to the event source mapping.

    • DestinationConfig (dict) --

      (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

    • Topics (list) --

      The name of the Kafka topic.

      • (string) --
    • Queues (list) --

      (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

      • (string) --
    • SourceAccessConfigurations (list) --

      An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

      • (dict) --

        To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

        • Type (string) --

          The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

          • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
          • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
          • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
          • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
          • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
          • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
          • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
          • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
          • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
        • URI (string) --

          The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

    • SelfManagedEventSource (dict) --

      The self-managed Apache Kafka cluster for your event source.

      • Endpoints (dict) --

        The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

        • (string) --
          • (list) --
            • (string) --
    • MaximumRecordAgeInSeconds (integer) --

      (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

    • BisectBatchOnFunctionError (boolean) --

      (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

    • MaximumRetryAttempts (integer) --

      (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

    • TumblingWindowInSeconds (integer) --

      (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

    • FunctionResponseTypes (list) --

      (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

      • (string) --
    • AmazonManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

    • SelfManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for a self-managed Apache Kafka event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns details about an event source mapping. To get a mapping's UUID, use ListEventSourceMappings.

response = client.get_event_source_mapping(
    UUID='14e0db71-xmpl-4eb5-b481-8945cf9d10c2',
)

print(response)

Expected Output:

{
    'BatchSize': 500,
    'BisectBatchOnFunctionError': False,
    'DestinationConfig': {
    },
    'EventSourceArn': 'arn:aws:sqs:us-east-2:123456789012:mySQSqueue',
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:myFunction',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'LastProcessingResult': 'No records processed',
    'MaximumRecordAgeInSeconds': 604800,
    'MaximumRetryAttempts': 10000,
    'State': 'Creating',
    'StateTransitionReason': 'User action',
    'UUID': '14e0db71-xmpl-4eb5-b481-8945cf9d10c2',
    '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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
        '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,
                'SigningProfileVersionArn': 'string',
                'SigningJobArn': 'string'
            },
        ],
        'State': 'Pending'|'Active'|'Inactive'|'Failed',
        'StateReason': 'string',
        'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
        'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
        'LastUpdateStatusReason': 'string',
        'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
        'FileSystemConfigs': [
            {
                'Arn': 'string',
                'LocalMountPath': 'string'
            },
        ],
        'PackageType': 'Zip'|'Image',
        'ImageConfigResponse': {
            'ImageConfig': {
                'EntryPoint': [
                    'string',
                ],
                'Command': [
                    'string',
                ],
                'WorkingDirectory': 'string'
            },
            'Error': {
                'ErrorCode': 'string',
                'Message': 'string'
            }
        },
        'SigningProfileVersionArn': 'string',
        'SigningJobArn': 'string',
        'Architectures': [
            'x86_64'|'arm64',
        ],
        'EphemeralStorage': {
            'Size': 123
        },
        'SnapStart': {
            'ApplyOn': 'PublishedVersions'|'None',
            'OptimizationStatus': 'On'|'Off'
        }
    },
    'Code': {
        'RepositoryType': 'string',
        'Location': 'string',
        'ImageUri': 'string',
        'ResolvedImageUri': '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 running 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 in seconds that Lambda allows a function to run before stopping it.

      • MemorySize (integer) --

        The amount of memory available to the function at runtime.

      • 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 group 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. Omitted from CloudTrail logs.

        • Variables (dict) --

          Environment variable key-value pairs. Omitted from CloudTrail logs.

          • (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 returned only if you've configured a customer managed key.

      • TracingConfig (dict) --

        The function's X-Ray tracing configuration.

        • Mode (string) --

          The tracing mode.

      • MasterArn (string) --

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

      • RevisionId (string) --

        The latest updated revision of the function or alias.

      • Layers (list) --

        The function's layers.

        • (dict) --

          An Lambda layer.

          • Arn (string) --

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

          • CodeSize (integer) --

            The size of the layer archive in bytes.

          • SigningProfileVersionArn (string) --

            The Amazon Resource Name (ARN) for a signing profile version.

          • SigningJobArn (string) --

            The Amazon Resource Name (ARN) of a signing job.

      • State (string) --

        The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

      • StateReason (string) --

        The reason for the function's current state.

      • StateReasonCode (string) --

        The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

      • LastUpdateStatus (string) --

        The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

      • LastUpdateStatusReason (string) --

        The reason for the last update that was performed on the function.

      • LastUpdateStatusReasonCode (string) --

        The reason code for the last update that was performed on the function.

      • FileSystemConfigs (list) --

        Connection settings for an Amazon EFS file system.

        • (dict) --

          Details about the connection between a Lambda function and an Amazon EFS file system.

          • Arn (string) --

            The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

          • LocalMountPath (string) --

            The path where the function can access the file system, starting with /mnt/ .

      • PackageType (string) --

        The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

      • ImageConfigResponse (dict) --

        The function's image configuration values.

        • ImageConfig (dict) --

          Configuration values that override the container image Dockerfile.

          • EntryPoint (list) --

            Specifies the entry point to their application, which is typically the location of the runtime executable.

            • (string) --
          • Command (list) --

            Specifies parameters that you want to pass in with ENTRYPOINT.

            • (string) --
          • WorkingDirectory (string) --

            Specifies the working directory.

        • Error (dict) --

          Error response to GetFunctionConfiguration .

          • ErrorCode (string) --

            Error code.

          • Message (string) --

            Error message.

      • SigningProfileVersionArn (string) --

        The ARN of the signing profile version.

      • SigningJobArn (string) --

        The ARN of the signing job.

      • Architectures (list) --

        The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

        • (string) --
      • EphemeralStorage (dict) --

        The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

        • Size (integer) --

          The size of the function's /tmp directory.

      • SnapStart (dict) --

        Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

        • ApplyOn (string) --

          When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

        • OptimizationStatus (string) --

          When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

    • 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.

      • ImageUri (string) --

        URI of a container image in the Amazon ECR registry.

      • ResolvedImageUri (string) --

        The resolved URI for the image.

    • 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 Lambda reserved concurrency.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException

Examples

The following example returns code and configuration details for version 1 of a function named my-function.

response = client.get_function(
    FunctionName='my-function',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Code': {
        'Location': 'https://awslambda-us-west-2-tasks.s3.us-west-2.amazonaws.com/snapshots/123456789012/my-function-e7d9d1ed-xmpl-4f79-904a-4b87f2681f30?versionId=sH3TQwBOaUy...',
        'RepositoryType': 'S3',
    },
    'Configuration': {
        'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
        'CodeSize': 5797206,
        'Description': 'Process image objects from Amazon S3.',
        'Environment': {
            'Variables': {
                'BUCKET': 'my-bucket-1xpuxmplzrlbh',
                'PREFIX': 'inbound',
            },
        },
        'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
        'FunctionName': 'my-function',
        'Handler': 'index.handler',
        'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
        'LastModified': '2020-04-10T19:06:32.563+0000',
        'LastUpdateStatus': 'Successful',
        'MemorySize': 256,
        'RevisionId': 'b75dcd81-xmpl-48a8-a75a-93ba8b5b9727',
        'Role': 'arn:aws:iam::123456789012:role/lambda-role',
        'Runtime': 'nodejs12.x',
        'State': 'Active',
        'Timeout': 15,
        'TracingConfig': {
            'Mode': 'Active',
        },
        'Version': '$LATEST',
    },
    'Tags': {
        'DEPARTMENT': 'Assets',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
get_function_code_signing_config(**kwargs)

Returns the code signing configuration for the specified function.

See also: AWS API Documentation

Request Syntax

response = client.get_function_code_signing_config(
    FunctionName='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.

Return type
dict
Returns
Response Syntax
{
    'CodeSigningConfigArn': 'string',
    'FunctionName': 'string'
}

Response Structure

  • (dict) --
    • CodeSigningConfigArn (string) --

      The The Amazon Resource Name (ARN) of the code signing configuration.

    • FunctionName (string) --

      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.

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException
get_function_concurrency(**kwargs)

Returns details about the reserved concurrency configuration for a function. To set a concurrency limit for a function, use PutFunctionConcurrency.

See also: AWS API Documentation

Request Syntax

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

[REQUIRED]

The name of the Lambda function.

Name formats
  • Function namemy-function .
  • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
  • Partial ARN123456789012: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.

Return type
dict
Returns
Response Syntax
{
    'ReservedConcurrentExecutions': 123
}

Response Structure

  • (dict) --
    • ReservedConcurrentExecutions (integer) --

      The number of simultaneous executions that are reserved for the function.

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

The following example returns the reserved concurrency setting for a function named my-function.

response = client.get_function_concurrency(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'ReservedConcurrentExecutions': 250,
    '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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    '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,
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string'
        },
    ],
    'State': 'Pending'|'Active'|'Inactive'|'Failed',
    'StateReason': 'string',
    'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
    'LastUpdateStatusReason': 'string',
    'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'FileSystemConfigs': [
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    'PackageType': 'Zip'|'Image',
    'ImageConfigResponse': {
        'ImageConfig': {
            'EntryPoint': [
                'string',
            ],
            'Command': [
                'string',
            ],
            'WorkingDirectory': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'SigningProfileVersionArn': 'string',
    'SigningJobArn': 'string',
    'Architectures': [
        'x86_64'|'arm64',
    ],
    'EphemeralStorage': {
        'Size': 123
    },
    'SnapStart': {
        'ApplyOn': 'PublishedVersions'|'None',
        'OptimizationStatus': 'On'|'Off'
    }
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The amount of memory available to the function at runtime.

    • 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 group 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. Omitted from CloudTrail logs.

      • Variables (dict) --

        Environment variable key-value pairs. Omitted from CloudTrail logs.

        • (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 returned only if you've configured a customer managed key.

    • TracingConfig (dict) --

      The function's X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

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

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers.

      • (dict) --

        An Lambda layer.

        • Arn (string) --

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

        • CodeSize (integer) --

          The size of the layer archive in bytes.

        • SigningProfileVersionArn (string) --

          The Amazon Resource Name (ARN) for a signing profile version.

        • SigningJobArn (string) --

          The Amazon Resource Name (ARN) of a signing job.

    • State (string) --

      The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

    • StateReason (string) --

      The reason for the function's current state.

    • StateReasonCode (string) --

      The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

    • LastUpdateStatus (string) --

      The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

    • LastUpdateStatusReason (string) --

      The reason for the last update that was performed on the function.

    • LastUpdateStatusReasonCode (string) --

      The reason code for the last update that was performed on the function.

    • FileSystemConfigs (list) --

      Connection settings for an Amazon EFS file system.

      • (dict) --

        Details about the connection between a Lambda function and an Amazon EFS file system.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

        • LocalMountPath (string) --

          The path where the function can access the file system, starting with /mnt/ .

    • PackageType (string) --

      The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

    • ImageConfigResponse (dict) --

      The function's image configuration values.

      • ImageConfig (dict) --

        Configuration values that override the container image Dockerfile.

        • EntryPoint (list) --

          Specifies the entry point to their application, which is typically the location of the runtime executable.

          • (string) --
        • Command (list) --

          Specifies parameters that you want to pass in with ENTRYPOINT.

          • (string) --
        • WorkingDirectory (string) --

          Specifies the working directory.

      • Error (dict) --

        Error response to GetFunctionConfiguration .

        • ErrorCode (string) --

          Error code.

        • Message (string) --

          Error message.

    • SigningProfileVersionArn (string) --

      The ARN of the signing profile version.

    • SigningJobArn (string) --

      The ARN of the signing job.

    • Architectures (list) --

      The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

      • (string) --
    • EphemeralStorage (dict) --

      The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

      • Size (integer) --

        The size of the function's /tmp directory.

    • SnapStart (dict) --

      Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

      • ApplyOn (string) --

        When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

      • OptimizationStatus (string) --

        When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException

Examples

The following example returns and configuration details for version 1 of a function named my-function.

response = client.get_function_configuration(
    FunctionName='my-function',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
    'CodeSize': 5797206,
    'Description': 'Process image objects from Amazon S3.',
    'Environment': {
        'Variables': {
            'BUCKET': 'my-bucket-1xpuxmplzrlbh',
            'PREFIX': 'inbound',
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
    'FunctionName': 'my-function',
    'Handler': 'index.handler',
    'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
    'LastModified': '2020-04-10T19:06:32.563+0000',
    'LastUpdateStatus': 'Successful',
    'MemorySize': 256,
    'RevisionId': 'b75dcd81-xmpl-48a8-a75a-93ba8b5b9727',
    'Role': 'arn:aws:iam::123456789012:role/lambda-role',
    'Runtime': 'nodejs12.x',
    'State': 'Active',
    'Timeout': 15,
    'TracingConfig': {
        'Mode': 'Active',
    },
    'Version': '$LATEST',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_function_event_invoke_config(**kwargs)

Retrieves the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

See also: AWS API Documentation

Request Syntax

response = client.get_function_event_invoke_config(
    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) -- A version number or alias name.
Return type

dict

Returns

Response Syntax

{
    'LastModified': datetime(2015, 1, 1),
    'FunctionArn': 'string',
    'MaximumRetryAttempts': 123,
    'MaximumEventAgeInSeconds': 123,
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • LastModified (datetime) --

      The date and time that the configuration was last updated.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of the function.

    • MaximumRetryAttempts (integer) --

      The maximum number of times to retry when the function returns an error.

    • MaximumEventAgeInSeconds (integer) --

      The maximum age of a request that Lambda sends to a function for processing.

    • DestinationConfig (dict) --

      A destination for events after they have been sent to a function for processing.

      Destinations

      • Function - The Amazon Resource Name (ARN) of a Lambda function.
      • Queue - The ARN of an SQS queue.
      • Topic - The ARN of an SNS topic.
      • Event Bus - The ARN of an Amazon EventBridge event bus.
      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns the asynchronous invocation configuration for the BLUE alias of a function named my-function.

response = client.get_function_event_invoke_config(
    FunctionName='my-function',
    Qualifier='BLUE',
)

print(response)

Expected Output:

{
    'DestinationConfig': {
        'OnFailure': {
            'Destination': 'arn:aws:sqs:us-east-2:123456789012:failed-invocations',
        },
        'OnSuccess': {
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'MaximumEventAgeInSeconds': 3600,
    'MaximumRetryAttempts': 0,
    'ResponseMetadata': {
        '...': '...',
    },
}
get_function_url_config(**kwargs)

Returns details about a Lambda function URL.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) -- The alias name.
Return type

dict

Returns

Response Syntax

{
    'FunctionUrl': 'string',
    'FunctionArn': 'string',
    'AuthType': 'NONE'|'AWS_IAM',
    'Cors': {
        'AllowCredentials': True|False,
        'AllowHeaders': [
            'string',
        ],
        'AllowMethods': [
            'string',
        ],
        'AllowOrigins': [
            'string',
        ],
        'ExposeHeaders': [
            'string',
        ],
        'MaxAge': 123
    },
    'CreationTime': 'string',
    'LastModifiedTime': 'string'
}

Response Structure

  • (dict) --

    • FunctionUrl (string) --

      The HTTP URL endpoint for your function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of your function.

    • AuthType (string) --

      The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

    • Cors (dict) --

      The cross-origin resource sharing (CORS) settings for your function URL.

      • AllowCredentials (boolean) --

        Whether to allow cookies or other credentials in requests to your function URL. The default is false .

      • AllowHeaders (list) --

        The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • AllowMethods (list) --

        The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

        • (string) --
      • AllowOrigins (list) --

        The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

        Alternatively, you can grant access to all origins using the wildcard character ( * ).

        • (string) --
      • ExposeHeaders (list) --

        The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • MaxAge (integer) --

        The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

    • CreationTime (string) --

      When the function URL was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • LastModifiedTime (string) --

      When the function URL configuration was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
get_layer_version(**kwargs)

Returns information about a version of an 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,
        'SigningProfileVersionArn': 'string',
        'SigningJobArn': 'string'
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    ],
    'LicenseInfo': 'string',
    'CompatibleArchitectures': [
        'x86_64'|'arm64',
    ]
}

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.

      • SigningProfileVersionArn (string) --

        The Amazon Resource Name (ARN) for a signing profile version.

      • SigningJobArn (string) --

        The Amazon Resource Name (ARN) of a signing job.

    • 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.

    • CompatibleArchitectures (list) --

      A list of compatible instruction set architectures.

      • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceNotFoundException

Examples

The following example returns information for version 1 of a layer named my-layer.

response = client.get_layer_version(
    LayerName='my-layer',
    VersionNumber=1,
)

print(response)

Expected Output:

{
    'CompatibleRuntimes': [
        'python3.6',
        'python3.7',
    ],
    'Content': {
        'CodeSha256': 'tv9jJO+rPbXUUXuRKi7CwHzKtLDkDRJLB3cC3Z/ouXo=',
        'CodeSize': 169,
        'Location': 'https://awslambda-us-east-2-layers.s3.us-east-2.amazonaws.com/snapshots/123456789012/my-layer-4aaa2fbb-ff77-4b0a-ad92-5b78a716a96a?versionId=27iWyA73cCAYqyH...',
    },
    'CreatedDate': '2018-11-14T23:03:52.894+0000',
    'Description': 'My Python layer',
    'LayerArn': 'arn:aws:lambda:us-east-2:123456789012:layer:my-layer',
    'LayerVersionArn': 'arn:aws:lambda:us-east-2:123456789012:layer:my-layer:1',
    'LicenseInfo': 'MIT',
    'Version': 1,
    'ResponseMetadata': {
        '...': '...',
    },
}
get_layer_version_by_arn(**kwargs)

Returns information about a version of an 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,
        'SigningProfileVersionArn': 'string',
        'SigningJobArn': 'string'
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    ],
    'LicenseInfo': 'string',
    'CompatibleArchitectures': [
        'x86_64'|'arm64',
    ]
}

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.

      • SigningProfileVersionArn (string) --

        The Amazon Resource Name (ARN) for a signing profile version.

      • SigningJobArn (string) --

        The Amazon Resource Name (ARN) of a signing job.

    • 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.

    • CompatibleArchitectures (list) --

      A list of compatible instruction set architectures.

      • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceNotFoundException

Examples

The following example returns information about the layer version with the specified Amazon Resource Name (ARN).

response = client.get_layer_version_by_arn(
    Arn='arn:aws:lambda:ca-central-1:123456789012:layer:blank-python-lib:3',
)

print(response)

Expected Output:

{
    'CompatibleRuntimes': [
        'python3.8',
    ],
    'Content': {
        'CodeSha256': '6x+xmpl/M3BnQUk7gS9sGmfeFsR/npojXoA3fZUv4eU=',
        'CodeSize': 9529009,
        'Location': 'https://awslambda-us-east-2-layers.s3.us-east-2.amazonaws.com/snapshots/123456789012/blank-python-lib-e5212378-xmpl-44ee-8398-9d8ec5113949?versionId=WbZnvf...',
    },
    'CreatedDate': '2020-03-31T00:35:18.949+0000',
    'Description': 'Dependencies for the blank-python sample app.',
    'LayerArn': 'arn:aws:lambda:us-east-2:123456789012:layer:blank-python-lib',
    'LayerVersionArn': 'arn:aws:lambda:us-east-2:123456789012:layer:blank-python-lib:3',
    'Version': 3,
    'ResponseMetadata': {
        '...': '...',
    },
}
get_layer_version_policy(**kwargs)

Returns the permission policy for a version of an 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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException

Examples

The following example returns the resource-based policy for version 1 of a Lambda function named my-function.

response = client.get_policy(
    FunctionName='my-function',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Policy': '{"Version":"2012-10-17","Id":"default","Statement":[{"Sid":"xaccount","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::123456789012:root"},"Action":"lambda:InvokeFunction","Resource":"arn:aws:lambda:us-east-2:123456789012:function:my-function:1"}]}',
    'RevisionId': '4843f2f6-7c59-4fda-b484-afd0bc0e22b8',
    'ResponseMetadata': {
        '...': '...',
    },
}
get_provisioned_concurrency_config(**kwargs)

Retrieves the provisioned concurrency configuration for a function's alias or version.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) --

    [REQUIRED]

    The version number or alias name.

Return type

dict

Returns

Response Syntax

{
    'RequestedProvisionedConcurrentExecutions': 123,
    'AvailableProvisionedConcurrentExecutions': 123,
    'AllocatedProvisionedConcurrentExecutions': 123,
    'Status': 'IN_PROGRESS'|'READY'|'FAILED',
    'StatusReason': 'string',
    'LastModified': 'string'
}

Response Structure

  • (dict) --

    • RequestedProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency requested.

    • AvailableProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency available.

    • AllocatedProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency allocated. When a weighted alias is used during linear and canary deployments, this value fluctuates depending on the amount of concurrency that is provisioned for the function versions.

    • Status (string) --

      The status of the allocation process.

    • StatusReason (string) --

      For failed allocations, the reason that provisioned concurrency could not be allocated.

    • LastModified (string) --

      The date and time that a user last updated the configuration, in ISO 8601 format.

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ProvisionedConcurrencyConfigNotFoundException

Examples

The following example returns details for the provisioned concurrency configuration for the BLUE alias of the specified function.

response = client.get_provisioned_concurrency_config(
    FunctionName='my-function',
    Qualifier='BLUE',
)

print(response)

Expected Output:

{
    'AllocatedProvisionedConcurrentExecutions': 100,
    'AvailableProvisionedConcurrentExecutions': 100,
    'LastModified': '2019-12-31T20:28:49+0000',
    'RequestedProvisionedConcurrentExecutions': 100,
    'Status': 'READY',
    'ResponseMetadata': {
        '...': '...',
    },
}

The following example displays details for the provisioned concurrency configuration for the BLUE alias of the specified function.

response = client.get_provisioned_concurrency_config(
    FunctionName='my-function',
    Qualifier='BLUE',
)

print(response)

Expected Output:

{
    'AllocatedProvisionedConcurrentExecutions': 100,
    'AvailableProvisionedConcurrentExecutions': 100,
    'LastModified': '2019-12-31T20:28:49+0000',
    'RequestedProvisionedConcurrentExecutions': 100,
    'Status': 'READY',
    '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.

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 Error handling and automatic retries in Lambda.

For asynchronous invocation, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a dead-letter queue.

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, quota errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if running 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 disconnect 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. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts.

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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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 one is 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. Applies to synchronously invoked functions only.
  • ClientContext (string) -- Up to 3,583 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.

    You can enter the JSON directly. For example, --payload '{ "key": "value" }' . You can also specify a file path. For example, --payload file://payload.json .

  • 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.

    • 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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidRequestContentException
  • Lambda.Client.exceptions.RequestTooLargeException
  • Lambda.Client.exceptions.UnsupportedMediaTypeException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.EC2UnexpectedException
  • Lambda.Client.exceptions.SubnetIPAddressLimitReachedException
  • Lambda.Client.exceptions.ENILimitReachedException
  • Lambda.Client.exceptions.EFSMountConnectivityException
  • Lambda.Client.exceptions.EFSMountFailureException
  • Lambda.Client.exceptions.EFSMountTimeoutException
  • Lambda.Client.exceptions.EFSIOException
  • Lambda.Client.exceptions.SnapStartException
  • Lambda.Client.exceptions.SnapStartTimeoutException
  • Lambda.Client.exceptions.SnapStartNotReadyException
  • Lambda.Client.exceptions.EC2ThrottledException
  • Lambda.Client.exceptions.EC2AccessDeniedException
  • Lambda.Client.exceptions.InvalidSubnetIDException
  • Lambda.Client.exceptions.InvalidSecurityGroupIDException
  • Lambda.Client.exceptions.InvalidZipFileException
  • Lambda.Client.exceptions.KMSDisabledException
  • Lambda.Client.exceptions.KMSInvalidStateException
  • Lambda.Client.exceptions.KMSAccessDeniedException
  • Lambda.Client.exceptions.KMSNotFoundException
  • Lambda.Client.exceptions.InvalidRuntimeException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceNotReadyException

Examples

The following example invokes version 1 of a function named my-function with an empty event payload.

response = client.invoke(
    FunctionName='my-function',
    Payload='{}',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Payload': '200 SUCCESS',
    'StatusCode': 200,
    'ResponseMetadata': {
        '...': '...',
    },
}

The following example invokes version 1 of a function named my-function asynchronously.

response = client.invoke(
    FunctionName='my-function',
    InvocationType='Event',
    Payload='{}',
    Qualifier='1',
)

print(response)

Expected Output:

{
    'Payload': '',
    'StatusCode': 202,
    '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 namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidRequestContentException
  • Lambda.Client.exceptions.InvalidRuntimeException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example invokes a Lambda function asynchronously

response = client.invoke_async(
    FunctionName='my-function',
    InvokeArgs='{}',
)

print(response)

Expected Output:

{
    'Status': 202,
    '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 second version, and the percentage of traffic that's routed to it.

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

          A unique identifier that changes when you update the alias.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns a list of aliases for a function named my-function.

response = client.list_aliases(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'Aliases': [
        {
            'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:BETA',
            'Description': 'Production environment BLUE.',
            'FunctionVersion': '2',
            'Name': 'BLUE',
            'RevisionId': 'a410117f-xmpl-494e-8035-7e204bb7933b',
            'RoutingConfig': {
                'AdditionalVersionWeights': {
                    '1': 0.7,
                },
            },
        },
        {
            'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:LIVE',
            'Description': 'Production environment GREEN.',
            'FunctionVersion': '1',
            'Name': 'GREEN',
            'RevisionId': '21d40116-xmpl-40ba-9360-3ea284da1bb5',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
list_code_signing_configs(**kwargs)

Returns a list of code signing configurations. A request returns up to 10,000 configurations per call. You can use the MaxItems parameter to return fewer configurations per call.

See also: AWS API Documentation

Request Syntax

response = client.list_code_signing_configs(
    Marker='string',
    MaxItems=123
)
Parameters
  • Marker (string) -- Specify the pagination token that's returned by a previous request to retrieve the next page of results.
  • MaxItems (integer) -- Maximum number of items to return.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'CodeSigningConfigs': [
        {
            'CodeSigningConfigId': 'string',
            'CodeSigningConfigArn': 'string',
            'Description': 'string',
            'AllowedPublishers': {
                'SigningProfileVersionArns': [
                    'string',
                ]
            },
            'CodeSigningPolicies': {
                'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
            },
            'LastModified': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

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

    • CodeSigningConfigs (list) --

      The code signing configurations

      • (dict) --

        Details about a Code signing configuration.

        • CodeSigningConfigId (string) --

          Unique identifer for the Code signing configuration.

        • CodeSigningConfigArn (string) --

          The Amazon Resource Name (ARN) of the Code signing configuration.

        • Description (string) --

          Code signing configuration description.

        • AllowedPublishers (dict) --

          List of allowed publishers.

          • SigningProfileVersionArns (list) --

            The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

            • (string) --
        • CodeSigningPolicies (dict) --

          The code signing policy controls the validation failure action for signature mismatch or expiry.

          • UntrustedArtifactOnDeployment (string) --

            Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

            Default value: Warn

        • LastModified (string) --

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
list_event_source_mappings(**kwargs)

Lists event source mappings. Specify an EventSourceArn to show only 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.
    • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.
    • Amazon MQ - The ARN of the broker.
  • 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. Note that ListEventSourceMappings returns a maximum of 100 items in each response, even if you set the number higher.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'EventSourceMappings': [
        {
            'UUID': 'string',
            'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
            'StartingPositionTimestamp': datetime(2015, 1, 1),
            'BatchSize': 123,
            'MaximumBatchingWindowInSeconds': 123,
            'ParallelizationFactor': 123,
            'EventSourceArn': 'string',
            'FilterCriteria': {
                'Filters': [
                    {
                        'Pattern': 'string'
                    },
                ]
            },
            'FunctionArn': 'string',
            'LastModified': datetime(2015, 1, 1),
            'LastProcessingResult': 'string',
            'State': 'string',
            'StateTransitionReason': 'string',
            'DestinationConfig': {
                'OnSuccess': {
                    'Destination': 'string'
                },
                'OnFailure': {
                    'Destination': 'string'
                }
            },
            'Topics': [
                'string',
            ],
            'Queues': [
                'string',
            ],
            'SourceAccessConfigurations': [
                {
                    'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
                    'URI': 'string'
                },
            ],
            'SelfManagedEventSource': {
                'Endpoints': {
                    'string': [
                        'string',
                    ]
                }
            },
            'MaximumRecordAgeInSeconds': 123,
            'BisectBatchOnFunctionError': True|False,
            'MaximumRetryAttempts': 123,
            'TumblingWindowInSeconds': 123,
            'FunctionResponseTypes': [
                'ReportBatchItemFailures',
            ],
            'AmazonManagedKafkaEventSourceConfig': {
                'ConsumerGroupId': 'string'
            },
            'SelfManagedKafkaEventSourceConfig': {
                'ConsumerGroupId': '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 Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

        • UUID (string) --

          The identifier of the event source mapping.

        • StartingPosition (string) --

          The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

        • StartingPositionTimestamp (datetime) --

          With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

        • BatchSize (integer) --

          The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

          Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

          Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

        • MaximumBatchingWindowInSeconds (integer) --

          The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

          For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

          Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

        • ParallelizationFactor (integer) --

          (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

        • EventSourceArn (string) --

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

        • FilterCriteria (dict) --

          An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

          • Filters (list) --

            A list of filters.

            • (dict) --

              A structure within a FilterCriteria object that defines an event filtering pattern.

              • Pattern (string) --

                A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

        • FunctionArn (string) --

          The ARN of the Lambda function.

        • LastModified (datetime) --

          The date that the event source mapping was last updated or that its state changed.

        • LastProcessingResult (string) --

          The result of the last Lambda invocation of your 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) --

          Indicates whether a user or Lambda made the last change to the event source mapping.

        • DestinationConfig (dict) --

          (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

          • OnSuccess (dict) --

            The destination configuration for successful invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

          • OnFailure (dict) --

            The destination configuration for failed invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

        • Topics (list) --

          The name of the Kafka topic.

          • (string) --
        • Queues (list) --

          (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

          • (string) --
        • SourceAccessConfigurations (list) --

          An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

          • (dict) --

            To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

            • Type (string) --

              The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

              • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
              • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
              • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
              • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
              • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
              • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
              • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
              • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
              • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
            • URI (string) --

              The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

        • SelfManagedEventSource (dict) --

          The self-managed Apache Kafka cluster for your event source.

          • Endpoints (dict) --

            The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

            • (string) --
              • (list) --
                • (string) --
        • MaximumRecordAgeInSeconds (integer) --

          (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

        • BisectBatchOnFunctionError (boolean) --

          (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

        • MaximumRetryAttempts (integer) --

          (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

        • TumblingWindowInSeconds (integer) --

          (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

        • FunctionResponseTypes (list) --

          (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

          • (string) --
        • AmazonManagedKafkaEventSourceConfig (dict) --

          Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

          • ConsumerGroupId (string) --

            The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

        • SelfManagedKafkaEventSourceConfig (dict) --

          Specific configuration settings for a self-managed Apache Kafka event source.

          • ConsumerGroupId (string) --

            The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns a list of the event source mappings for a function named my-function.

response = client.list_event_source_mappings(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'EventSourceMappings': [
        {
            'BatchSize': 5,
            'EventSourceArn': 'arn:aws:sqs:us-west-2:123456789012:mySQSqueue',
            'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
            'LastModified': 1569284520.333,
            'State': 'Enabled',
            'StateTransitionReason': 'USER_INITIATED',
            'UUID': 'a1b2c3d4-5678-90ab-cdef-11111EXAMPLE',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
list_function_event_invoke_configs(**kwargs)

Retrieves a list of configurations for asynchronous invocation for a function.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

See also: AWS API Documentation

Request Syntax

response = client.list_function_event_invoke_configs(
    FunctionName='string',
    Marker='string',
    MaxItems=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.

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

dict

Returns

Response Syntax

{
    'FunctionEventInvokeConfigs': [
        {
            'LastModified': datetime(2015, 1, 1),
            'FunctionArn': 'string',
            'MaximumRetryAttempts': 123,
            'MaximumEventAgeInSeconds': 123,
            'DestinationConfig': {
                'OnSuccess': {
                    'Destination': 'string'
                },
                'OnFailure': {
                    'Destination': 'string'
                }
            }
        },
    ],
    'NextMarker': 'string'
}

Response Structure

  • (dict) --

    • FunctionEventInvokeConfigs (list) --

      A list of configurations.

      • (dict) --

        • LastModified (datetime) --

          The date and time that the configuration was last updated.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of the function.

        • MaximumRetryAttempts (integer) --

          The maximum number of times to retry when the function returns an error.

        • MaximumEventAgeInSeconds (integer) --

          The maximum age of a request that Lambda sends to a function for processing.

        • DestinationConfig (dict) --

          A destination for events after they have been sent to a function for processing.

          Destinations

          • Function - The Amazon Resource Name (ARN) of a Lambda function.
          • Queue - The ARN of an SQS queue.
          • Topic - The ARN of an SNS topic.
          • Event Bus - The ARN of an Amazon EventBridge event bus.
          • OnSuccess (dict) --

            The destination configuration for successful invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

          • OnFailure (dict) --

            The destination configuration for failed invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

    • NextMarker (string) --

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

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

The following example returns a list of asynchronous invocation configurations for a function named my-function.

response = client.list_function_event_invoke_configs(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'FunctionEventInvokeConfigs': [
        {
            'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:GREEN',
            'LastModified': 1577824406.719,
            'MaximumEventAgeInSeconds': 1800,
            'MaximumRetryAttempts': 2,
        },
        {
            'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE',
            'LastModified': 1577824396.653,
            'MaximumEventAgeInSeconds': 3600,
            'MaximumRetryAttempts': 0,
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
list_function_url_configs(**kwargs)

Returns a list of Lambda function URLs for the specified function.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Marker (string) -- Specify the pagination token that's returned by a previous request to retrieve the next page of results.
  • MaxItems (integer) -- The maximum number of function URLs to return in the response. Note that ListFunctionUrlConfigs returns a maximum of 50 items in each response, even if you set the number higher.
Return type

dict

Returns

Response Syntax

{
    'FunctionUrlConfigs': [
        {
            'FunctionUrl': 'string',
            'FunctionArn': 'string',
            'CreationTime': 'string',
            'LastModifiedTime': 'string',
            'Cors': {
                'AllowCredentials': True|False,
                'AllowHeaders': [
                    'string',
                ],
                'AllowMethods': [
                    'string',
                ],
                'AllowOrigins': [
                    'string',
                ],
                'ExposeHeaders': [
                    'string',
                ],
                'MaxAge': 123
            },
            'AuthType': 'NONE'|'AWS_IAM'
        },
    ],
    'NextMarker': 'string'
}

Response Structure

  • (dict) --

    • FunctionUrlConfigs (list) --

      A list of function URL configurations.

      • (dict) --

        Details about a Lambda function URL.

        • FunctionUrl (string) --

          The HTTP URL endpoint for your function.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of your function.

        • CreationTime (string) --

          When the function URL was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • LastModifiedTime (string) --

          When the function URL configuration was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • Cors (dict) --

          The cross-origin resource sharing (CORS) settings for your function URL.

          • AllowCredentials (boolean) --

            Whether to allow cookies or other credentials in requests to your function URL. The default is false .

          • AllowHeaders (list) --

            The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

            • (string) --
          • AllowMethods (list) --

            The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

            • (string) --
          • AllowOrigins (list) --

            The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

            Alternatively, you can grant access to all origins using the wildcard character ( * ).

            • (string) --
          • ExposeHeaders (list) --

            The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

            • (string) --
          • MaxAge (integer) --

            The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

        • AuthType (string) --

          The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

    • NextMarker (string) --

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

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
list_functions(**kwargs)

Returns a list of Lambda functions, with the version-specific configuration of each. Lambda returns up to 50 functions per call.

Set FunctionVersion to ALL to include all published versions of each function in addition to the unpublished version.

Note

The ListFunctions operation returns a subset of the FunctionConfiguration fields. To get the additional fields (State, StateReasonCode, StateReason, LastUpdateStatus, LastUpdateStatusReason, LastUpdateStatusReasonCode) for 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 Amazon Web Services Region of the master function. For example, us-east-1 filters the list of functions to include only Lambda@Edge functions replicated from a master function in US East (N. Virginia). 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) -- The maximum number of functions to return in the response. Note that ListFunctions returns a maximum of 50 items in each response, even if you set the number higher.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Functions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            '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,
                    'SigningProfileVersionArn': 'string',
                    'SigningJobArn': 'string'
                },
            ],
            'State': 'Pending'|'Active'|'Inactive'|'Failed',
            'StateReason': 'string',
            'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
            'LastUpdateStatusReason': 'string',
            'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'FileSystemConfigs': [
                {
                    'Arn': 'string',
                    'LocalMountPath': 'string'
                },
            ],
            'PackageType': 'Zip'|'Image',
            'ImageConfigResponse': {
                'ImageConfig': {
                    'EntryPoint': [
                        'string',
                    ],
                    'Command': [
                        'string',
                    ],
                    'WorkingDirectory': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string',
            'Architectures': [
                'x86_64'|'arm64',
            ],
            'EphemeralStorage': {
                'Size': 123
            },
            'SnapStart': {
                'ApplyOn': 'PublishedVersions'|'None',
                'OptimizationStatus': 'On'|'Off'
            }
        },
    ]
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The amount of memory available to the function at runtime.

        • 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 group 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. Omitted from CloudTrail logs.

          • Variables (dict) --

            Environment variable key-value pairs. Omitted from CloudTrail logs.

            • (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 returned only if you've configured a customer managed key.

        • TracingConfig (dict) --

          The function's X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

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

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers.

          • (dict) --

            An Lambda layer.

            • Arn (string) --

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

            • CodeSize (integer) --

              The size of the layer archive in bytes.

            • SigningProfileVersionArn (string) --

              The Amazon Resource Name (ARN) for a signing profile version.

            • SigningJobArn (string) --

              The Amazon Resource Name (ARN) of a signing job.

        • State (string) --

          The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

        • StateReason (string) --

          The reason for the function's current state.

        • StateReasonCode (string) --

          The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

        • LastUpdateStatus (string) --

          The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

        • LastUpdateStatusReason (string) --

          The reason for the last update that was performed on the function.

        • LastUpdateStatusReasonCode (string) --

          The reason code for the last update that was performed on the function.

        • FileSystemConfigs (list) --

          Connection settings for an Amazon EFS file system.

          • (dict) --

            Details about the connection between a Lambda function and an Amazon EFS file system.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

            • LocalMountPath (string) --

              The path where the function can access the file system, starting with /mnt/ .

        • PackageType (string) --

          The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

        • ImageConfigResponse (dict) --

          The function's image configuration values.

          • ImageConfig (dict) --

            Configuration values that override the container image Dockerfile.

            • EntryPoint (list) --

              Specifies the entry point to their application, which is typically the location of the runtime executable.

              • (string) --
            • Command (list) --

              Specifies parameters that you want to pass in with ENTRYPOINT.

              • (string) --
            • WorkingDirectory (string) --

              Specifies the working directory.

          • Error (dict) --

            Error response to GetFunctionConfiguration .

            • ErrorCode (string) --

              Error code.

            • Message (string) --

              Error message.

        • SigningProfileVersionArn (string) --

          The ARN of the signing profile version.

        • SigningJobArn (string) --

          The ARN of the signing job.

        • Architectures (list) --

          The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

          • (string) --
        • EphemeralStorage (dict) --

          The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

          • Size (integer) --

            The size of the function's /tmp directory.

        • SnapStart (dict) --

          Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

          • ApplyOn (string) --

            When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

          • OptimizationStatus (string) --

            When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException

Examples

This operation returns a list of Lambda functions.

response = client.list_functions(
)

print(response)

Expected Output:

{
    'Functions': [
        {
            'CodeSha256': 'dBG9m8SGdmlEjw/JYXlhhvCrAv5TxvXsbL/RMr0fT/I=',
            'CodeSize': 294,
            'Description': '',
            'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:helloworld',
            'FunctionName': 'helloworld',
            'Handler': 'helloworld.handler',
            'LastModified': '2019-09-23T18:32:33.857+0000',
            'MemorySize': 128,
            'RevisionId': '1718e831-badf-4253-9518-d0644210af7b',
            'Role': 'arn:aws:iam::123456789012:role/service-role/MyTestFunction-role-zgur6bf4',
            'Runtime': 'nodejs10.x',
            'Timeout': 3,
            'TracingConfig': {
                'Mode': 'PassThrough',
            },
            'Version': '$LATEST',
        },
        {
            'CodeSha256': 'sU0cJ2/hOZevwV/lTxCuQqK3gDZP3i8gUoqUUVRmY6E=',
            'CodeSize': 266,
            'Description': '',
            'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
            'FunctionName': 'my-function',
            'Handler': 'index.handler',
            'LastModified': '2019-10-01T16:47:28.490+0000',
            'MemorySize': 256,
            'RevisionId': '93017fc9-59cb-41dc-901b-4845ce4bf668',
            'Role': 'arn:aws:iam::123456789012:role/service-role/helloWorldPython-role-uy3l9qyq',
            'Runtime': 'nodejs10.x',
            'Timeout': 3,
            'TracingConfig': {
                'Mode': 'PassThrough',
            },
            'Version': '$LATEST',
            'VpcConfig': {
                'SecurityGroupIds': [
                ],
                'SubnetIds': [
                ],
                'VpcId': '',
            },
        },
    ],
    'NextMarker': '',
    'ResponseMetadata': {
        '...': '...',
    },
}
list_functions_by_code_signing_config(**kwargs)

List the functions that use the specified code signing configuration. You can use this method prior to deleting a code signing configuration, to verify that no functions are using it.

See also: AWS API Documentation

Request Syntax

response = client.list_functions_by_code_signing_config(
    CodeSigningConfigArn='string',
    Marker='string',
    MaxItems=123
)
Parameters
  • CodeSigningConfigArn (string) --

    [REQUIRED]

    The The Amazon Resource Name (ARN) of the code signing configuration.

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

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'FunctionArns': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • NextMarker (string) --

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

    • FunctionArns (list) --

      The function ARNs.

      • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
list_layer_versions(**kwargs)

Lists the versions of an 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. Specify a compatible architecture to include only layer versions that are compatible with that architecture.

See also: AWS API Documentation

Request Syntax

response = client.list_layer_versions(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    LayerName='string',
    Marker='string',
    MaxItems=123,
    CompatibleArchitecture='x86_64'|'arm64'
)
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.
  • CompatibleArchitecture (string) -- The compatible instruction set architecture.
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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            ],
            'LicenseInfo': 'string',
            'CompatibleArchitectures': [
                'x86_64'|'arm64',
            ]
        },
    ]
}

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 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.

        • CompatibleArchitectures (list) --

          A list of compatible instruction set architectures.

          • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example displays information about the versions for the layer named blank-java-lib

response = client.list_layer_versions(
    LayerName='blank-java-lib',
)

print(response)

Expected Output:

{
    'LayerVersions': [
        {
            'CompatibleRuntimes': [
                'java8',
            ],
            'CreatedDate': '2020-03-18T23:38:42.284+0000',
            'Description': 'Dependencies for the blank-java sample app.',
            'LayerVersionArn': 'arn:aws:lambda:us-east-2:123456789012:layer:blank-java-lib:7',
            'Version': 7,
        },
        {
            'CompatibleRuntimes': [
                'java8',
            ],
            'CreatedDate': '2020-03-17T07:24:21.960+0000',
            'Description': 'Dependencies for the blank-java sample app.',
            'LayerVersionArn': 'arn:aws:lambda:us-east-2:123456789012:layer:blank-java-lib:6',
            'Version': 6,
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
list_layers(**kwargs)

Lists 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. Specify a compatible architecture to include only layers that are compatible with that instruction set architecture.

See also: AWS API Documentation

Request Syntax

response = client.list_layers(
    CompatibleRuntime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    Marker='string',
    MaxItems=123,
    CompatibleArchitecture='x86_64'|'arm64'
)
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.
  • CompatibleArchitecture (string) -- The compatible instruction set architecture.
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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
                ],
                'LicenseInfo': 'string',
                'CompatibleArchitectures': [
                    'x86_64'|'arm64',
                ]
            }
        },
    ]
}

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 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.

          • CompatibleArchitectures (list) --

            A list of compatible instruction set architectures.

            • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns information about layers that are compatible with the Python 3.7 runtime.

response = client.list_layers(
    CompatibleRuntime='python3.7',
)

print(response)

Expected Output:

{
    'Layers': [
        {
            'LatestMatchingVersion': {
                'CompatibleRuntimes': [
                    'python3.6',
                    'python3.7',
                ],
                'CreatedDate': '2018-11-15T00:37:46.592+0000',
                'Description': 'My layer',
                'LayerVersionArn': 'arn:aws:lambda:us-east-2:123456789012:layer:my-layer:2',
                'Version': 2,
            },
            'LayerArn': 'arn:aws:lambda:us-east-2:123456789012:layer:my-layer',
            'LayerName': 'my-layer',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
list_provisioned_concurrency_configs(**kwargs)

Retrieves a list of provisioned concurrency configurations for a function.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

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

dict

Returns

Response Syntax

{
    'ProvisionedConcurrencyConfigs': [
        {
            'FunctionArn': 'string',
            'RequestedProvisionedConcurrentExecutions': 123,
            'AvailableProvisionedConcurrentExecutions': 123,
            'AllocatedProvisionedConcurrentExecutions': 123,
            'Status': 'IN_PROGRESS'|'READY'|'FAILED',
            'StatusReason': 'string',
            'LastModified': 'string'
        },
    ],
    'NextMarker': 'string'
}

Response Structure

  • (dict) --

    • ProvisionedConcurrencyConfigs (list) --

      A list of provisioned concurrency configurations.

      • (dict) --

        Details about the provisioned concurrency configuration for a function alias or version.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of the alias or version.

        • RequestedProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency requested.

        • AvailableProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency available.

        • AllocatedProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency allocated. When a weighted alias is used during linear and canary deployments, this value fluctuates depending on the amount of concurrency that is provisioned for the function versions.

        • Status (string) --

          The status of the allocation process.

        • StatusReason (string) --

          For failed allocations, the reason that provisioned concurrency could not be allocated.

        • LastModified (string) --

          The date and time that a user last updated the configuration, in ISO 8601 format.

    • NextMarker (string) --

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

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

The following example returns a list of provisioned concurrency configurations for a function named my-function.

response = client.list_provisioned_concurrency_configs(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'ProvisionedConcurrencyConfigs': [
        {
            'AllocatedProvisionedConcurrentExecutions': 100,
            'AvailableProvisionedConcurrentExecutions': 100,
            'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:GREEN',
            'LastModified': '2019-12-31T20:29:00+0000',
            'RequestedProvisionedConcurrentExecutions': 100,
            'Status': 'READY',
        },
        {
            'AllocatedProvisionedConcurrentExecutions': 100,
            'AvailableProvisionedConcurrentExecutions': 100,
            'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:BLUE',
            'LastModified': '2019-12-31T20:28:49+0000',
            'RequestedProvisionedConcurrentExecutions': 100,
            'Status': 'READY',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
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). Note: Lambda does not support adding tags to aliases or versions.

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

Response Structure

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

      The function's tags.

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example displays the tags attached to the my-function Lambda function.

response = client.list_tags(
    Resource='arn:aws:lambda:us-west-2:123456789012:function:my-function',
)

print(response)

Expected Output:

{
    'Tags': {
        'Category': 'Web Tools',
        'Department': 'Sales',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
list_versions_by_function(**kwargs)

Returns a list of versions, with the version-specific configuration of each. Lambda returns up to 50 versions per call.

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) -- The maximum number of versions to return. Note that ListVersionsByFunction returns a maximum of 50 items in each response, even if you set the number higher.
Return type

dict

Returns

Response Syntax

{
    'NextMarker': 'string',
    'Versions': [
        {
            'FunctionName': 'string',
            'FunctionArn': 'string',
            'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            '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,
                    'SigningProfileVersionArn': 'string',
                    'SigningJobArn': 'string'
                },
            ],
            'State': 'Pending'|'Active'|'Inactive'|'Failed',
            'StateReason': 'string',
            'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
            'LastUpdateStatusReason': 'string',
            'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'FileSystemConfigs': [
                {
                    'Arn': 'string',
                    'LocalMountPath': 'string'
                },
            ],
            'PackageType': 'Zip'|'Image',
            'ImageConfigResponse': {
                'ImageConfig': {
                    'EntryPoint': [
                        'string',
                    ],
                    'Command': [
                        'string',
                    ],
                    'WorkingDirectory': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string',
            'Architectures': [
                'x86_64'|'arm64',
            ],
            'EphemeralStorage': {
                'Size': 123
            },
            'SnapStart': {
                'ApplyOn': 'PublishedVersions'|'None',
                'OptimizationStatus': 'On'|'Off'
            }
        },
    ]
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The amount of memory available to the function at runtime.

        • 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 group 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. Omitted from CloudTrail logs.

          • Variables (dict) --

            Environment variable key-value pairs. Omitted from CloudTrail logs.

            • (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 returned only if you've configured a customer managed key.

        • TracingConfig (dict) --

          The function's X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

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

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers.

          • (dict) --

            An Lambda layer.

            • Arn (string) --

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

            • CodeSize (integer) --

              The size of the layer archive in bytes.

            • SigningProfileVersionArn (string) --

              The Amazon Resource Name (ARN) for a signing profile version.

            • SigningJobArn (string) --

              The Amazon Resource Name (ARN) of a signing job.

        • State (string) --

          The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

        • StateReason (string) --

          The reason for the function's current state.

        • StateReasonCode (string) --

          The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

        • LastUpdateStatus (string) --

          The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

        • LastUpdateStatusReason (string) --

          The reason for the last update that was performed on the function.

        • LastUpdateStatusReasonCode (string) --

          The reason code for the last update that was performed on the function.

        • FileSystemConfigs (list) --

          Connection settings for an Amazon EFS file system.

          • (dict) --

            Details about the connection between a Lambda function and an Amazon EFS file system.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

            • LocalMountPath (string) --

              The path where the function can access the file system, starting with /mnt/ .

        • PackageType (string) --

          The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

        • ImageConfigResponse (dict) --

          The function's image configuration values.

          • ImageConfig (dict) --

            Configuration values that override the container image Dockerfile.

            • EntryPoint (list) --

              Specifies the entry point to their application, which is typically the location of the runtime executable.

              • (string) --
            • Command (list) --

              Specifies parameters that you want to pass in with ENTRYPOINT.

              • (string) --
            • WorkingDirectory (string) --

              Specifies the working directory.

          • Error (dict) --

            Error response to GetFunctionConfiguration .

            • ErrorCode (string) --

              Error code.

            • Message (string) --

              Error message.

        • SigningProfileVersionArn (string) --

          The ARN of the signing profile version.

        • SigningJobArn (string) --

          The ARN of the signing job.

        • Architectures (list) --

          The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

          • (string) --
        • EphemeralStorage (dict) --

          The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

          • Size (integer) --

            The size of the function's /tmp directory.

        • SnapStart (dict) --

          Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

          • ApplyOn (string) --

            When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

          • OptimizationStatus (string) --

            When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException

Examples

The following example returns a list of versions of a function named my-function

response = client.list_versions_by_function(
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'Versions': [
        {
            'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
            'CodeSize': 5797206,
            'Description': 'Process image objects from Amazon S3.',
            'Environment': {
                'Variables': {
                    'BUCKET': 'my-bucket-1xpuxmplzrlbh',
                    'PREFIX': 'inbound',
                },
            },
            'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
            'FunctionName': 'my-function',
            'Handler': 'index.handler',
            'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
            'LastModified': '2020-04-10T19:06:32.563+0000',
            'MemorySize': 256,
            'RevisionId': '850ca006-2d98-4ff4-86db-8766e9d32fe9',
            'Role': 'arn:aws:iam::123456789012:role/lambda-role',
            'Runtime': 'nodejs12.x',
            'Timeout': 15,
            'TracingConfig': {
                'Mode': 'Active',
            },
            'Version': '$LATEST',
        },
        {
            'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
            'CodeSize': 5797206,
            'Description': 'Process image objects from Amazon S3.',
            'Environment': {
                'Variables': {
                    'BUCKET': 'my-bucket-1xpuxmplzrlbh',
                    'PREFIX': 'inbound',
                },
            },
            'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
            'FunctionName': 'my-function',
            'Handler': 'index.handler',
            'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
            'LastModified': '2020-04-10T19:06:32.563+0000',
            'MemorySize': 256,
            'RevisionId': 'b75dcd81-xmpl-48a8-a75a-93ba8b5b9727',
            'Role': 'arn:aws:iam::123456789012:role/lambda-role',
            'Runtime': 'nodejs12.x',
            'Timeout': 5,
            'TracingConfig': {
                'Mode': 'Active',
            },
            'Version': '1',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}
publish_layer_version(**kwargs)

Creates an Lambda layer from a ZIP archive. Each time you call PublishLayerVersion with the same layer 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    ],
    LicenseInfo='string',
    CompatibleArchitectures=[
        'x86_64'|'arm64',
    ]
)
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. Amazon Web Services SDK and Amazon Web Services 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.
  • CompatibleArchitectures (list) --

    A list of compatible instruction set architectures.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Content': {
        'Location': 'string',
        'CodeSha256': 'string',
        'CodeSize': 123,
        'SigningProfileVersionArn': 'string',
        'SigningJobArn': 'string'
    },
    'LayerArn': 'string',
    'LayerVersionArn': 'string',
    'Description': 'string',
    'CreatedDate': 'string',
    'Version': 123,
    'CompatibleRuntimes': [
        'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    ],
    'LicenseInfo': 'string',
    'CompatibleArchitectures': [
        'x86_64'|'arm64',
    ]
}

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.

      • SigningProfileVersionArn (string) --

        The Amazon Resource Name (ARN) for a signing profile version.

      • SigningJobArn (string) --

        The Amazon Resource Name (ARN) of a signing job.

    • 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.

    • CompatibleArchitectures (list) --

      A list of compatible instruction set architectures.

      • (string) --

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.CodeStorageExceededException

Examples

The following example creates a new Python library layer version. The command retrieves the layer content a file named layer.zip in the specified S3 bucket.

response = client.publish_layer_version(
    CompatibleRuntimes=[
        'python3.6',
        'python3.7',
    ],
    Content={
        'S3Bucket': 'lambda-layers-us-west-2-123456789012',
        'S3Key': 'layer.zip',
    },
    Description='My Python layer',
    LayerName='my-layer',
    LicenseInfo='MIT',
)

print(response)

Expected Output:

{
    'CompatibleRuntimes': [
        'python3.6',
        'python3.7',
    ],
    'Content': {
        'CodeSha256': 'tv9jJO+rPbXUUXuRKi7CwHzKtLDkDRJLB3cC3Z/ouXo=',
        'CodeSize': 169,
        'Location': 'https://awslambda-us-west-2-layers.s3.us-west-2.amazonaws.com/snapshots/123456789012/my-layer-4aaa2fbb-ff77-4b0a-ad92-5b78a716a96a?versionId=27iWyA73cCAYqyH...',
    },
    'CreatedDate': '2018-11-14T23:03:52.894+0000',
    'Description': 'My Python layer',
    'LayerArn': 'arn:aws:lambda:us-west-2:123456789012:layer:my-layer',
    'LayerVersionArn': 'arn:aws:lambda:us-west-2:123456789012:layer:my-layer:1',
    'LicenseInfo': 'MIT',
    'Version': 1,
    'ResponseMetadata': {
        '...': '...',
    },
}
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.

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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    '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,
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string'
        },
    ],
    'State': 'Pending'|'Active'|'Inactive'|'Failed',
    'StateReason': 'string',
    'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
    'LastUpdateStatusReason': 'string',
    'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'FileSystemConfigs': [
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    'PackageType': 'Zip'|'Image',
    'ImageConfigResponse': {
        'ImageConfig': {
            'EntryPoint': [
                'string',
            ],
            'Command': [
                'string',
            ],
            'WorkingDirectory': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'SigningProfileVersionArn': 'string',
    'SigningJobArn': 'string',
    'Architectures': [
        'x86_64'|'arm64',
    ],
    'EphemeralStorage': {
        'Size': 123
    },
    'SnapStart': {
        'ApplyOn': 'PublishedVersions'|'None',
        'OptimizationStatus': 'On'|'Off'
    }
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The amount of memory available to the function at runtime.

    • 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 group 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. Omitted from CloudTrail logs.

      • Variables (dict) --

        Environment variable key-value pairs. Omitted from CloudTrail logs.

        • (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 returned only if you've configured a customer managed key.

    • TracingConfig (dict) --

      The function's X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

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

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers.

      • (dict) --

        An Lambda layer.

        • Arn (string) --

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

        • CodeSize (integer) --

          The size of the layer archive in bytes.

        • SigningProfileVersionArn (string) --

          The Amazon Resource Name (ARN) for a signing profile version.

        • SigningJobArn (string) --

          The Amazon Resource Name (ARN) of a signing job.

    • State (string) --

      The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

    • StateReason (string) --

      The reason for the function's current state.

    • StateReasonCode (string) --

      The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

    • LastUpdateStatus (string) --

      The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

    • LastUpdateStatusReason (string) --

      The reason for the last update that was performed on the function.

    • LastUpdateStatusReasonCode (string) --

      The reason code for the last update that was performed on the function.

    • FileSystemConfigs (list) --

      Connection settings for an Amazon EFS file system.

      • (dict) --

        Details about the connection between a Lambda function and an Amazon EFS file system.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

        • LocalMountPath (string) --

          The path where the function can access the file system, starting with /mnt/ .

    • PackageType (string) --

      The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

    • ImageConfigResponse (dict) --

      The function's image configuration values.

      • ImageConfig (dict) --

        Configuration values that override the container image Dockerfile.

        • EntryPoint (list) --

          Specifies the entry point to their application, which is typically the location of the runtime executable.

          • (string) --
        • Command (list) --

          Specifies parameters that you want to pass in with ENTRYPOINT.

          • (string) --
        • WorkingDirectory (string) --

          Specifies the working directory.

      • Error (dict) --

        Error response to GetFunctionConfiguration .

        • ErrorCode (string) --

          Error code.

        • Message (string) --

          Error message.

    • SigningProfileVersionArn (string) --

      The ARN of the signing profile version.

    • SigningJobArn (string) --

      The ARN of the signing job.

    • Architectures (list) --

      The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

      • (string) --
    • EphemeralStorage (dict) --

      The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

      • Size (integer) --

        The size of the function's /tmp directory.

    • SnapStart (dict) --

      Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

      • ApplyOn (string) --

        When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

      • OptimizationStatus (string) --

        When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.CodeStorageExceededException
  • Lambda.Client.exceptions.PreconditionFailedException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

This operation publishes a version of a Lambda function

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

print(response)

Expected Output:

{
    'CodeSha256': 'YFgDgEKG3ugvF1+pX64gV6tu9qNuIYNUdgJm8nCxsm4=',
    'CodeSize': 5797206,
    'Description': 'Process image objects from Amazon S3.',
    'Environment': {
        'Variables': {
            'BUCKET': 'my-bucket-1xpuxmplzrlbh',
            'PREFIX': 'inbound',
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function',
    'FunctionName': 'my-function',
    'Handler': 'index.handler',
    'KMSKeyArn': 'arn:aws:kms:us-west-2:123456789012:key/b0844d6c-xmpl-4463-97a4-d49f50839966',
    'LastModified': '2020-04-10T19:06:32.563+0000',
    'LastUpdateStatus': 'Successful',
    'MemorySize': 256,
    'RevisionId': 'b75dcd81-xmpl-48a8-a75a-93ba8b5b9727',
    'Role': 'arn:aws:iam::123456789012:role/lambda-role',
    'Runtime': 'nodejs12.x',
    'State': 'Active',
    'Timeout': 5,
    'TracingConfig': {
        'Mode': 'Active',
    },
    'Version': '1',
    'ResponseMetadata': {
        '...': '...',
    },
}
put_function_code_signing_config(**kwargs)

Update the code signing configuration for the function. Changes to the code signing configuration take effect the next time a user tries to deploy a code package to the function.

See also: AWS API Documentation

Request Syntax

response = client.put_function_code_signing_config(
    CodeSigningConfigArn='string',
    FunctionName='string'
)
Parameters
  • CodeSigningConfigArn (string) --

    [REQUIRED]

    The The Amazon Resource Name (ARN) of the code signing configuration.

  • 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.

Return type

dict

Returns

Response Syntax

{
    'CodeSigningConfigArn': 'string',
    'FunctionName': 'string'
}

Response Structure

  • (dict) --

    • CodeSigningConfigArn (string) --

      The The Amazon Resource Name (ARN) of the code signing configuration.

    • FunctionName (string) --

      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.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.CodeSigningConfigNotFoundException
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 Lambda function scaling.

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 namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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 Lambda reserved concurrency.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example configures 100 reserved concurrent executions for the my-function function.

response = client.put_function_concurrency(
    FunctionName='my-function',
    ReservedConcurrentExecutions=100,
)

print(response)

Expected Output:

{
    'ReservedConcurrentExecutions': 100,
    'ResponseMetadata': {
        '...': '...',
    },
}
put_function_event_invoke_config(**kwargs)

Configures options for asynchronous invocation on a function, version, or alias. If a configuration already exists for a function, version, or alias, this operation overwrites it. If you exclude any settings, they are removed. To set one option without affecting existing settings for other options, use UpdateFunctionEventInvokeConfig.

By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it. To retain discarded events, configure a dead-letter queue with UpdateFunctionConfiguration.

To send an invocation record to a queue, topic, function, or event bus, specify a destination. You can configure separate destinations for successful invocations (on-success) and events that fail all processing attempts (on-failure). You can configure destinations in addition to or instead of a dead-letter queue.

See also: AWS API Documentation

Request Syntax

response = client.put_function_event_invoke_config(
    FunctionName='string',
    Qualifier='string',
    MaximumRetryAttempts=123,
    MaximumEventAgeInSeconds=123,
    DestinationConfig={
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': '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) -- A version number or alias name.
  • MaximumRetryAttempts (integer) -- The maximum number of times to retry when the function returns an error.
  • MaximumEventAgeInSeconds (integer) -- The maximum age of a request that Lambda sends to a function for processing.
  • DestinationConfig (dict) --

    A destination for events after they have been sent to a function for processing.

    Destinations
    • Function - The Amazon Resource Name (ARN) of a Lambda function.
    • Queue - The ARN of an SQS queue.
    • Topic - The ARN of an SNS topic.
    • Event Bus - The ARN of an Amazon EventBridge event bus.
    • OnSuccess (dict) --

      The destination configuration for successful invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

    • OnFailure (dict) --

      The destination configuration for failed invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

Return type

dict

Returns

Response Syntax

{
    'LastModified': datetime(2015, 1, 1),
    'FunctionArn': 'string',
    'MaximumRetryAttempts': 123,
    'MaximumEventAgeInSeconds': 123,
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • LastModified (datetime) --

      The date and time that the configuration was last updated.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of the function.

    • MaximumRetryAttempts (integer) --

      The maximum number of times to retry when the function returns an error.

    • MaximumEventAgeInSeconds (integer) --

      The maximum age of a request that Lambda sends to a function for processing.

    • DestinationConfig (dict) --

      A destination for events after they have been sent to a function for processing.

      Destinations

      • Function - The Amazon Resource Name (ARN) of a Lambda function.
      • Queue - The ARN of an SQS queue.
      • Topic - The ARN of an SNS topic.
      • Event Bus - The ARN of an Amazon EventBridge event bus.
      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example sets a maximum event age of one hour and disables retries for the specified function.

response = client.put_function_event_invoke_config(
    FunctionName='my-function',
    MaximumEventAgeInSeconds=3600,
    MaximumRetryAttempts=0,
)

print(response)

Expected Output:

{
    'DestinationConfig': {
        'OnFailure': {
        },
        'OnSuccess': {
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:$LATEST',
    'LastModified': datetime(2016, 11, 21, 19, 49, 20, 0, 326, 0),
    'MaximumEventAgeInSeconds': 3600,
    'MaximumRetryAttempts': 0,
    'ResponseMetadata': {
        '...': '...',
    },
}
put_provisioned_concurrency_config(**kwargs)

Adds a provisioned concurrency configuration to a function's alias or version.

See also: AWS API Documentation

Request Syntax

response = client.put_provisioned_concurrency_config(
    FunctionName='string',
    Qualifier='string',
    ProvisionedConcurrentExecutions=123
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) --

    [REQUIRED]

    The version number or alias name.

  • ProvisionedConcurrentExecutions (integer) --

    [REQUIRED]

    The amount of provisioned concurrency to allocate for the version or alias.

Return type

dict

Returns

Response Syntax

{
    'RequestedProvisionedConcurrentExecutions': 123,
    'AvailableProvisionedConcurrentExecutions': 123,
    'AllocatedProvisionedConcurrentExecutions': 123,
    'Status': 'IN_PROGRESS'|'READY'|'FAILED',
    'StatusReason': 'string',
    'LastModified': 'string'
}

Response Structure

  • (dict) --

    • RequestedProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency requested.

    • AvailableProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency available.

    • AllocatedProvisionedConcurrentExecutions (integer) --

      The amount of provisioned concurrency allocated. When a weighted alias is used during linear and canary deployments, this value fluctuates depending on the amount of concurrency that is provisioned for the function versions.

    • Status (string) --

      The status of the allocation process.

    • StatusReason (string) --

      For failed allocations, the reason that provisioned concurrency could not be allocated.

    • LastModified (string) --

      The date and time that a user last updated the configuration, in ISO 8601 format.

Exceptions

  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ServiceException

Examples

The following example allocates 100 provisioned concurrency for the BLUE alias of the specified function.

response = client.put_provisioned_concurrency_config(
    FunctionName='my-function',
    ProvisionedConcurrentExecutions=100,
    Qualifier='BLUE',
)

print(response)

Expected Output:

{
    'AllocatedProvisionedConcurrentExecutions': 0,
    'LastModified': '2019-11-21T19:32:12+0000',
    'RequestedProvisionedConcurrentExecutions': 100,
    'Status': 'IN_PROGRESS',
    'ResponseMetadata': {
        '...': '...',
    },
}
remove_layer_version_permission(**kwargs)

Removes a statement from the permissions policy for a version of an 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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.PreconditionFailedException

Examples

The following example deletes permission for an account to configure a layer version.

response = client.remove_layer_version_permission(
    LayerName='my-layer',
    StatementId='xaccount',
    VersionNumber=1,
)

print(response)

Expected Output:

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

Revokes function-use permission from an Amazon Web Service or another Amazon Web Services 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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) -- Update the policy only 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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.PreconditionFailedException

Examples

The following example removes a permissions statement named xaccount from the PROD alias of a function named my-function.

response = client.remove_permission(
    FunctionName='my-function',
    Qualifier='PROD',
    StatementId='xaccount',
)

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example adds a tag with the key name DEPARTMENT and a value of 'Department A' to the specified Lambda function.

response = client.tag_resource(
    Resource='arn:aws:lambda:us-west-2:123456789012:function:my-function',
    Tags={
        'DEPARTMENT': 'Department A',
    },
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example removes the tag with the key name DEPARTMENT tag from the my-function Lambda function.

response = client.untag_resource(
    Resource='arn:aws:lambda:us-west-2:123456789012:function:my-function',
    TagKeys=[
        'DEPARTMENT',
    ],
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}
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 second version, 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 second version, and the percentage of traffic that's routed to it.

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

      A unique identifier that changes when you update the alias.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.PreconditionFailedException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example updates the alias named BLUE to send 30% of traffic to version 2 and 70% to version 1.

response = client.update_alias(
    FunctionName='my-function',
    FunctionVersion='2',
    Name='BLUE',
    RoutingConfig={
        'AdditionalVersionWeights': {
            '1': 0.7,
        },
    },
)

print(response)

Expected Output:

{
    'AliasArn': 'arn:aws:lambda:us-west-2:123456789012:function:my-function:BLUE',
    'Description': 'Production environment BLUE.',
    'FunctionVersion': '2',
    'Name': 'BLUE',
    'RevisionId': '594f41fb-xmpl-4c20-95c7-6ca5f2a92c93',
    'RoutingConfig': {
        'AdditionalVersionWeights': {
            '1': 0.7,
        },
    },
    'ResponseMetadata': {
        '...': '...',
    },
}
update_code_signing_config(**kwargs)

Update the code signing configuration. Changes to the code signing configuration take effect the next time a user tries to deploy a code package to the function.

See also: AWS API Documentation

Request Syntax

response = client.update_code_signing_config(
    CodeSigningConfigArn='string',
    Description='string',
    AllowedPublishers={
        'SigningProfileVersionArns': [
            'string',
        ]
    },
    CodeSigningPolicies={
        'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
    }
)
Parameters
  • CodeSigningConfigArn (string) --

    [REQUIRED]

    The The Amazon Resource Name (ARN) of the code signing configuration.

  • Description (string) -- Descriptive name for this code signing configuration.
  • AllowedPublishers (dict) --

    Signing profiles for this code signing configuration.

    • SigningProfileVersionArns (list) -- [REQUIRED]

      The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

      • (string) --
  • CodeSigningPolicies (dict) --

    The code signing policy.

    • UntrustedArtifactOnDeployment (string) --

      Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

      Default value: Warn

Return type

dict

Returns

Response Syntax

{
    'CodeSigningConfig': {
        'CodeSigningConfigId': 'string',
        'CodeSigningConfigArn': 'string',
        'Description': 'string',
        'AllowedPublishers': {
            'SigningProfileVersionArns': [
                'string',
            ]
        },
        'CodeSigningPolicies': {
            'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
        },
        'LastModified': 'string'
    }
}

Response Structure

  • (dict) --

    • CodeSigningConfig (dict) --

      The code signing configuration

      • CodeSigningConfigId (string) --

        Unique identifer for the Code signing configuration.

      • CodeSigningConfigArn (string) --

        The Amazon Resource Name (ARN) of the Code signing configuration.

      • Description (string) --

        Code signing configuration description.

      • AllowedPublishers (dict) --

        List of allowed publishers.

        • SigningProfileVersionArns (list) --

          The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

          • (string) --
      • CodeSigningPolicies (dict) --

        The code signing policy controls the validation failure action for signature mismatch or expiry.

        • UntrustedArtifactOnDeployment (string) --

          Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

          Default value: Warn

      • LastModified (string) --

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

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ResourceNotFoundException
update_event_source_mapping(**kwargs)

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

For details about how to configure different event sources, see the following topics.

The following error handling options are available only for stream sources (DynamoDB and Kinesis):

  • BisectBatchOnFunctionError - If the function returns an error, split the batch in two and retry.
  • DestinationConfig - Send discarded records to an Amazon SQS queue or Amazon SNS topic.
  • MaximumRecordAgeInSeconds - Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires
  • MaximumRetryAttempts - Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.
  • ParallelizationFactor - Process multiple batches from each shard concurrently.

For information about which configuration parameters apply to each event source, see the following topics.

See also: AWS API Documentation

Request Syntax

response = client.update_event_source_mapping(
    UUID='string',
    FunctionName='string',
    Enabled=True|False,
    BatchSize=123,
    FilterCriteria={
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    MaximumBatchingWindowInSeconds=123,
    DestinationConfig={
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    MaximumRecordAgeInSeconds=123,
    BisectBatchOnFunctionError=True|False,
    MaximumRetryAttempts=123,
    ParallelizationFactor=123,
    SourceAccessConfigurations=[
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    TumblingWindowInSeconds=123,
    FunctionResponseTypes=[
        'ReportBatchItemFailures',
    ]
)
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) --

    When true, the event source mapping is active. When false, Lambda pauses polling and invocation.

    Default: True

  • BatchSize (integer) --

    The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

    • Amazon Kinesis - Default 100. Max 10,000.
    • Amazon DynamoDB Streams - Default 100. Max 10,000.
    • Amazon Simple Queue Service - Default 10. For standard queues the max is 10,000. For FIFO queues the max is 10.
    • Amazon Managed Streaming for Apache Kafka - Default 100. Max 10,000.
    • Self-managed Apache Kafka - Default 100. Max 10,000.
    • Amazon MQ (ActiveMQ and RabbitMQ) - Default 100. Max 10,000.
  • FilterCriteria (dict) --

    An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

    • Filters (list) --

      A list of filters.

      • (dict) --

        A structure within a FilterCriteria object that defines an event filtering pattern.

        • Pattern (string) --

          A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

  • MaximumBatchingWindowInSeconds (integer) --

    The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

    For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

    Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

  • DestinationConfig (dict) --

    (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

    • OnSuccess (dict) --

      The destination configuration for successful invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

    • OnFailure (dict) --

      The destination configuration for failed invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

  • MaximumRecordAgeInSeconds (integer) -- (Streams only) Discard records older than the specified age. The default value is infinite (-1).
  • BisectBatchOnFunctionError (boolean) -- (Streams only) If the function returns an error, split the batch in two and retry.
  • MaximumRetryAttempts (integer) -- (Streams only) Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.
  • ParallelizationFactor (integer) -- (Streams only) The number of batches to process from each shard concurrently.
  • SourceAccessConfigurations (list) --

    An array of authentication protocols or VPC components required to secure your event source.

    • (dict) --

      To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

      • Type (string) --

        The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

        • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
        • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
        • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
        • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
        • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
        • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
        • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
        • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
        • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
      • URI (string) --

        The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

  • TumblingWindowInSeconds (integer) -- (Streams only) The duration in seconds of a processing window. The range is between 1 second and 900 seconds.
  • FunctionResponseTypes (list) --

    (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'UUID': 'string',
    'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    'StartingPositionTimestamp': datetime(2015, 1, 1),
    'BatchSize': 123,
    'MaximumBatchingWindowInSeconds': 123,
    'ParallelizationFactor': 123,
    'EventSourceArn': 'string',
    'FilterCriteria': {
        'Filters': [
            {
                'Pattern': 'string'
            },
        ]
    },
    'FunctionArn': 'string',
    'LastModified': datetime(2015, 1, 1),
    'LastProcessingResult': 'string',
    'State': 'string',
    'StateTransitionReason': 'string',
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    },
    'Topics': [
        'string',
    ],
    'Queues': [
        'string',
    ],
    'SourceAccessConfigurations': [
        {
            'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
            'URI': 'string'
        },
    ],
    'SelfManagedEventSource': {
        'Endpoints': {
            'string': [
                'string',
            ]
        }
    },
    'MaximumRecordAgeInSeconds': 123,
    'BisectBatchOnFunctionError': True|False,
    'MaximumRetryAttempts': 123,
    'TumblingWindowInSeconds': 123,
    'FunctionResponseTypes': [
        'ReportBatchItemFailures',
    ],
    'AmazonManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    },
    'SelfManagedKafkaEventSourceConfig': {
        'ConsumerGroupId': 'string'
    }
}

Response Structure

  • (dict) --

    A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

    • UUID (string) --

      The identifier of the event source mapping.

    • StartingPosition (string) --

      The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

    • StartingPositionTimestamp (datetime) --

      With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

    • BatchSize (integer) --

      The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

      Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

      Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • MaximumBatchingWindowInSeconds (integer) --

      The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

      For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

      Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

    • ParallelizationFactor (integer) --

      (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

    • EventSourceArn (string) --

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

    • FilterCriteria (dict) --

      An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

      • Filters (list) --

        A list of filters.

        • (dict) --

          A structure within a FilterCriteria object that defines an event filtering pattern.

          • Pattern (string) --

            A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

    • FunctionArn (string) --

      The ARN of the Lambda function.

    • LastModified (datetime) --

      The date that the event source mapping was last updated or that its state changed.

    • LastProcessingResult (string) --

      The result of the last Lambda invocation of your 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) --

      Indicates whether a user or Lambda made the last change to the event source mapping.

    • DestinationConfig (dict) --

      (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

    • Topics (list) --

      The name of the Kafka topic.

      • (string) --
    • Queues (list) --

      (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

      • (string) --
    • SourceAccessConfigurations (list) --

      An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

      • (dict) --

        To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

        • Type (string) --

          The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

          • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
          • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
          • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
          • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
          • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
          • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
          • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
          • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
          • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
        • URI (string) --

          The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

    • SelfManagedEventSource (dict) --

      The self-managed Apache Kafka cluster for your event source.

      • Endpoints (dict) --

        The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

        • (string) --
          • (list) --
            • (string) --
    • MaximumRecordAgeInSeconds (integer) --

      (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

    • BisectBatchOnFunctionError (boolean) --

      (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

    • MaximumRetryAttempts (integer) --

      (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

    • TumblingWindowInSeconds (integer) --

      (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

    • FunctionResponseTypes (list) --

      (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

      • (string) --
    • AmazonManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

    • SelfManagedKafkaEventSourceConfig (dict) --

      Specific configuration settings for a self-managed Apache Kafka event source.

      • ConsumerGroupId (string) --

        The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceInUseException

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. If code signing is enabled for the function, the code package must be signed by a trusted publisher. For more information, see Configuring code signing for Lambda.

If the function's package type is Image , then you must specify the code package in ImageUri as the URI of a container image in the Amazon ECR registry.

If the function's package type is Zip , then you must specify the deployment package as a .zip file archive. Enter the Amazon S3 bucket and key of the code .zip file location. You can also provide the function code inline using the ZipFile field.

The code in the deployment package must be compatible with the target instruction set architecture of the function ( x86-64 or arm64 ).

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.

Note

For a function defined as a container image, Lambda resolves the image tag to an image digest. In Amazon ECR, if you update the image tag to a new image, Lambda does not automatically update the function.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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. Amazon Web Services SDK and CLI clients handle the encoding for you. Use only with a function defined with a .zip file archive deployment package.

    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 Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services account. Use only with a function defined with a .zip file archive deployment package.
  • S3Key (string) -- The Amazon S3 key of the deployment package. Use only with a function defined with a .zip file archive deployment package.
  • S3ObjectVersion (string) -- For versioned objects, the version of the deployment package object to use.
  • ImageUri (string) -- URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.
  • 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) -- Update the function only 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.
  • Architectures (list) --

    The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value is x86_64 .

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    '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,
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string'
        },
    ],
    'State': 'Pending'|'Active'|'Inactive'|'Failed',
    'StateReason': 'string',
    'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
    'LastUpdateStatusReason': 'string',
    'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'FileSystemConfigs': [
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    'PackageType': 'Zip'|'Image',
    'ImageConfigResponse': {
        'ImageConfig': {
            'EntryPoint': [
                'string',
            ],
            'Command': [
                'string',
            ],
            'WorkingDirectory': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'SigningProfileVersionArn': 'string',
    'SigningJobArn': 'string',
    'Architectures': [
        'x86_64'|'arm64',
    ],
    'EphemeralStorage': {
        'Size': 123
    },
    'SnapStart': {
        'ApplyOn': 'PublishedVersions'|'None',
        'OptimizationStatus': 'On'|'Off'
    }
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The amount of memory available to the function at runtime.

    • 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 group 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. Omitted from CloudTrail logs.

      • Variables (dict) --

        Environment variable key-value pairs. Omitted from CloudTrail logs.

        • (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 returned only if you've configured a customer managed key.

    • TracingConfig (dict) --

      The function's X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

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

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers.

      • (dict) --

        An Lambda layer.

        • Arn (string) --

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

        • CodeSize (integer) --

          The size of the layer archive in bytes.

        • SigningProfileVersionArn (string) --

          The Amazon Resource Name (ARN) for a signing profile version.

        • SigningJobArn (string) --

          The Amazon Resource Name (ARN) of a signing job.

    • State (string) --

      The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

    • StateReason (string) --

      The reason for the function's current state.

    • StateReasonCode (string) --

      The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

    • LastUpdateStatus (string) --

      The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

    • LastUpdateStatusReason (string) --

      The reason for the last update that was performed on the function.

    • LastUpdateStatusReasonCode (string) --

      The reason code for the last update that was performed on the function.

    • FileSystemConfigs (list) --

      Connection settings for an Amazon EFS file system.

      • (dict) --

        Details about the connection between a Lambda function and an Amazon EFS file system.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

        • LocalMountPath (string) --

          The path where the function can access the file system, starting with /mnt/ .

    • PackageType (string) --

      The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

    • ImageConfigResponse (dict) --

      The function's image configuration values.

      • ImageConfig (dict) --

        Configuration values that override the container image Dockerfile.

        • EntryPoint (list) --

          Specifies the entry point to their application, which is typically the location of the runtime executable.

          • (string) --
        • Command (list) --

          Specifies parameters that you want to pass in with ENTRYPOINT.

          • (string) --
        • WorkingDirectory (string) --

          Specifies the working directory.

      • Error (dict) --

        Error response to GetFunctionConfiguration .

        • ErrorCode (string) --

          Error code.

        • Message (string) --

          Error message.

    • SigningProfileVersionArn (string) --

      The ARN of the signing profile version.

    • SigningJobArn (string) --

      The ARN of the signing job.

    • Architectures (list) --

      The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

      • (string) --
    • EphemeralStorage (dict) --

      The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

      • Size (integer) --

        The size of the function's /tmp directory.

    • SnapStart (dict) --

      Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

      • ApplyOn (string) --

        When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

      • OptimizationStatus (string) --

        When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.CodeStorageExceededException
  • Lambda.Client.exceptions.PreconditionFailedException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.CodeVerificationFailedException
  • Lambda.Client.exceptions.InvalidCodeSignatureException
  • Lambda.Client.exceptions.CodeSigningConfigNotFoundException

Examples

The following example replaces the code of the unpublished ($LATEST) version of a function named my-function with the contents of the specified zip file in Amazon S3.

response = client.update_function_code(
    FunctionName='my-function',
    S3Bucket='my-bucket-1xpuxmplzrlbh',
    S3Key='function.zip',
)

print(response)

Expected Output:

{
    'CodeSha256': 'PFn4S+er27qk+UuZSTKEQfNKG/XNn7QJs90mJgq6oH8=',
    'CodeSize': 308,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function',
    'FunctionName': 'my-function',
    'Handler': 'index.handler',
    'LastModified': '2019-08-14T22:26:11.234+0000',
    'MemorySize': 128,
    'RevisionId': '873282ed-xmpl-4dc8-a069-d0c647e470c6',
    'Role': 'arn:aws:iam::123456789012:role/lambda-role',
    'Runtime': 'nodejs12.x',
    'Timeout': 3,
    'TracingConfig': {
        'Mode': 'PassThrough',
    },
    'Version': '$LATEST',
    'ResponseMetadata': {
        '...': '...',
    },
}
update_function_configuration(**kwargs)

Modify the version-specific settings of a Lambda function.

When you update a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute. During this time, you can't modify the function, but you can still invoke it. The LastUpdateStatus , LastUpdateStatusReason , and LastUpdateStatusReasonCode fields in the response from GetFunctionConfiguration indicate when the update is complete and the function is processing events with the new configuration. For more information, see Lambda function states.

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 Amazon Web Services account or Amazon Web 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    DeadLetterConfig={
        'TargetArn': 'string'
    },
    KMSKeyArn='string',
    TracingConfig={
        'Mode': 'Active'|'PassThrough'
    },
    RevisionId='string',
    Layers=[
        'string',
    ],
    FileSystemConfigs=[
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    ImageConfig={
        'EntryPoint': [
            'string',
        ],
        'Command': [
            'string',
        ],
        'WorkingDirectory': 'string'
    },
    EphemeralStorage={
        'Size': 123
    },
    SnapStart={
        'ApplyOn': 'PublishedVersions'|'None'
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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 run your function. Handler is required if the deployment package is a .zip file archive. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Lambda programming model.
  • Description (string) -- A description of the function.
  • Timeout (integer) -- The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds. The maximum allowed value is 900 seconds. For more information, see Lambda execution environment.
  • MemorySize (integer) -- The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB.
  • VpcConfig (dict) --

    For network connectivity to Amazon Web Services 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 access resources and the internet only through that VPC. For more information, see Configuring a Lambda function to access resources in a VPC.

    • SubnetIds (list) --

      A list of VPC subnet IDs.

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

      A list of VPC security group IDs.

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

    Environment variables that are accessible from function code during execution.

  • Runtime (string) -- The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive.
  • 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 Key Management Service (KMS) key that's used to encrypt your function's environment variables. If it's not provided, Lambda uses a default service key.
  • TracingConfig (dict) --

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

    • Mode (string) --

      The tracing mode.

  • RevisionId (string) -- Update the function only 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) --
  • FileSystemConfigs (list) --

    Connection settings for an Amazon EFS file system.

    • (dict) --

      Details about the connection between a Lambda function and an Amazon EFS file system.

      • Arn (string) -- [REQUIRED]

        The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

      • LocalMountPath (string) -- [REQUIRED]

        The path where the function can access the file system, starting with /mnt/ .

  • ImageConfig (dict) --
    Container image configuration values that override the values in the container image Docker file.
    • EntryPoint (list) --

      Specifies the entry point to their application, which is typically the location of the runtime executable.

      • (string) --
    • Command (list) --

      Specifies parameters that you want to pass in with ENTRYPOINT.

      • (string) --
    • WorkingDirectory (string) --

      Specifies the working directory.

  • EphemeralStorage (dict) --

    The size of the function's /tmp directory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB.

    • Size (integer) -- [REQUIRED]

      The size of the function's /tmp directory.

  • SnapStart (dict) --

    The function's SnapStart setting.

    • ApplyOn (string) --

      Set to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version.

Return type

dict

Returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    '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,
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string'
        },
    ],
    'State': 'Pending'|'Active'|'Inactive'|'Failed',
    'StateReason': 'string',
    'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
    'LastUpdateStatusReason': 'string',
    'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
    'FileSystemConfigs': [
        {
            'Arn': 'string',
            'LocalMountPath': 'string'
        },
    ],
    'PackageType': 'Zip'|'Image',
    'ImageConfigResponse': {
        'ImageConfig': {
            'EntryPoint': [
                'string',
            ],
            'Command': [
                'string',
            ],
            'WorkingDirectory': 'string'
        },
        'Error': {
            'ErrorCode': 'string',
            'Message': 'string'
        }
    },
    'SigningProfileVersionArn': 'string',
    'SigningJobArn': 'string',
    'Architectures': [
        'x86_64'|'arm64',
    ],
    'EphemeralStorage': {
        'Size': 123
    },
    'SnapStart': {
        'ApplyOn': 'PublishedVersions'|'None',
        'OptimizationStatus': 'On'|'Off'
    }
}

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 running 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 in seconds that Lambda allows a function to run before stopping it.

    • MemorySize (integer) --

      The amount of memory available to the function at runtime.

    • 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 group 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. Omitted from CloudTrail logs.

      • Variables (dict) --

        Environment variable key-value pairs. Omitted from CloudTrail logs.

        • (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 returned only if you've configured a customer managed key.

    • TracingConfig (dict) --

      The function's X-Ray tracing configuration.

      • Mode (string) --

        The tracing mode.

    • MasterArn (string) --

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

    • RevisionId (string) --

      The latest updated revision of the function or alias.

    • Layers (list) --

      The function's layers.

      • (dict) --

        An Lambda layer.

        • Arn (string) --

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

        • CodeSize (integer) --

          The size of the layer archive in bytes.

        • SigningProfileVersionArn (string) --

          The Amazon Resource Name (ARN) for a signing profile version.

        • SigningJobArn (string) --

          The Amazon Resource Name (ARN) of a signing job.

    • State (string) --

      The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

    • StateReason (string) --

      The reason for the function's current state.

    • StateReasonCode (string) --

      The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

    • LastUpdateStatus (string) --

      The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

    • LastUpdateStatusReason (string) --

      The reason for the last update that was performed on the function.

    • LastUpdateStatusReasonCode (string) --

      The reason code for the last update that was performed on the function.

    • FileSystemConfigs (list) --

      Connection settings for an Amazon EFS file system.

      • (dict) --

        Details about the connection between a Lambda function and an Amazon EFS file system.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

        • LocalMountPath (string) --

          The path where the function can access the file system, starting with /mnt/ .

    • PackageType (string) --

      The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

    • ImageConfigResponse (dict) --

      The function's image configuration values.

      • ImageConfig (dict) --

        Configuration values that override the container image Dockerfile.

        • EntryPoint (list) --

          Specifies the entry point to their application, which is typically the location of the runtime executable.

          • (string) --
        • Command (list) --

          Specifies parameters that you want to pass in with ENTRYPOINT.

          • (string) --
        • WorkingDirectory (string) --

          Specifies the working directory.

      • Error (dict) --

        Error response to GetFunctionConfiguration .

        • ErrorCode (string) --

          Error code.

        • Message (string) --

          Error message.

    • SigningProfileVersionArn (string) --

      The ARN of the signing profile version.

    • SigningJobArn (string) --

      The ARN of the signing job.

    • Architectures (list) --

      The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

      • (string) --
    • EphemeralStorage (dict) --

      The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

      • Size (integer) --

        The size of the function's /tmp directory.

    • SnapStart (dict) --

      Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

      • ApplyOn (string) --

        When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

      • OptimizationStatus (string) --

        When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.PreconditionFailedException
  • Lambda.Client.exceptions.CodeVerificationFailedException
  • Lambda.Client.exceptions.InvalidCodeSignatureException
  • Lambda.Client.exceptions.CodeSigningConfigNotFoundException

Examples

The following example modifies the memory size to be 256 MB for the unpublished ($LATEST) version of a function named my-function.

response = client.update_function_configuration(
    FunctionName='my-function',
    MemorySize=256,
)

print(response)

Expected Output:

{
    'CodeSha256': 'PFn4S+er27qk+UuZSTKEQfNKG/XNn7QJs90mJgq6oH8=',
    'CodeSize': 308,
    'Description': '',
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function',
    'FunctionName': 'my-function',
    'Handler': 'index.handler',
    'LastModified': '2019-08-14T22:26:11.234+0000',
    'MemorySize': 256,
    'RevisionId': '873282ed-xmpl-4dc8-a069-d0c647e470c6',
    'Role': 'arn:aws:iam::123456789012:role/lambda-role',
    'Runtime': 'nodejs12.x',
    'Timeout': 3,
    'TracingConfig': {
        'Mode': 'PassThrough',
    },
    'Version': '$LATEST',
    'ResponseMetadata': {
        '...': '...',
    },
}
update_function_event_invoke_config(**kwargs)

Updates the configuration for asynchronous invocation for a function, version, or alias.

To configure options for asynchronous invocation, use PutFunctionEventInvokeConfig.

See also: AWS API Documentation

Request Syntax

response = client.update_function_event_invoke_config(
    FunctionName='string',
    Qualifier='string',
    MaximumRetryAttempts=123,
    MaximumEventAgeInSeconds=123,
    DestinationConfig={
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': '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) -- A version number or alias name.
  • MaximumRetryAttempts (integer) -- The maximum number of times to retry when the function returns an error.
  • MaximumEventAgeInSeconds (integer) -- The maximum age of a request that Lambda sends to a function for processing.
  • DestinationConfig (dict) --

    A destination for events after they have been sent to a function for processing.

    Destinations
    • Function - The Amazon Resource Name (ARN) of a Lambda function.
    • Queue - The ARN of an SQS queue.
    • Topic - The ARN of an SNS topic.
    • Event Bus - The ARN of an Amazon EventBridge event bus.
    • OnSuccess (dict) --

      The destination configuration for successful invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

    • OnFailure (dict) --

      The destination configuration for failed invocations.

      • Destination (string) --

        The Amazon Resource Name (ARN) of the destination resource.

Return type

dict

Returns

Response Syntax

{
    'LastModified': datetime(2015, 1, 1),
    'FunctionArn': 'string',
    'MaximumRetryAttempts': 123,
    'MaximumEventAgeInSeconds': 123,
    'DestinationConfig': {
        'OnSuccess': {
            'Destination': 'string'
        },
        'OnFailure': {
            'Destination': 'string'
        }
    }
}

Response Structure

  • (dict) --

    • LastModified (datetime) --

      The date and time that the configuration was last updated.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of the function.

    • MaximumRetryAttempts (integer) --

      The maximum number of times to retry when the function returns an error.

    • MaximumEventAgeInSeconds (integer) --

      The maximum age of a request that Lambda sends to a function for processing.

    • DestinationConfig (dict) --

      A destination for events after they have been sent to a function for processing.

      Destinations

      • Function - The Amazon Resource Name (ARN) of a Lambda function.
      • Queue - The ARN of an SQS queue.
      • Topic - The ARN of an SNS topic.
      • Event Bus - The ARN of an Amazon EventBridge event bus.
      • OnSuccess (dict) --

        The destination configuration for successful invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

      • OnFailure (dict) --

        The destination configuration for failed invocations.

        • Destination (string) --

          The Amazon Resource Name (ARN) of the destination resource.

Exceptions

  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.TooManyRequestsException
  • Lambda.Client.exceptions.ResourceConflictException

Examples

The following example adds an on-failure destination to the existing asynchronous invocation configuration for a function named my-function.

response = client.update_function_event_invoke_config(
    DestinationConfig={
        'OnFailure': {
            'Destination': 'arn:aws:sqs:us-east-2:123456789012:destination',
        },
    },
    FunctionName='my-function',
)

print(response)

Expected Output:

{
    'DestinationConfig': {
        'OnFailure': {
            'Destination': 'arn:aws:sqs:us-east-2:123456789012:destination',
        },
        'OnSuccess': {
        },
    },
    'FunctionArn': 'arn:aws:lambda:us-east-2:123456789012:function:my-function:$LATEST',
    'LastModified': 1573687896.493,
    'MaximumEventAgeInSeconds': 3600,
    'MaximumRetryAttempts': 0,
    'ResponseMetadata': {
        '...': '...',
    },
}
update_function_url_config(**kwargs)

Updates the configuration for a Lambda function URL.

See also: AWS API Documentation

Request Syntax

response = client.update_function_url_config(
    FunctionName='string',
    Qualifier='string',
    AuthType='NONE'|'AWS_IAM',
    Cors={
        'AllowCredentials': True|False,
        'AllowHeaders': [
            'string',
        ],
        'AllowMethods': [
            'string',
        ],
        'AllowOrigins': [
            'string',
        ],
        'ExposeHeaders': [
            'string',
        ],
        'MaxAge': 123
    }
)
Parameters
  • FunctionName (string) --

    [REQUIRED]

    The name of the Lambda function.

    Name formats
    • Function namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • Qualifier (string) -- The alias name.
  • AuthType (string) -- The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.
  • Cors (dict) --

    The cross-origin resource sharing (CORS) settings for your function URL.

    • AllowCredentials (boolean) --

      Whether to allow cookies or other credentials in requests to your function URL. The default is false .

    • AllowHeaders (list) --

      The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

      • (string) --
    • AllowMethods (list) --

      The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

      • (string) --
    • AllowOrigins (list) --

      The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

      Alternatively, you can grant access to all origins using the wildcard character ( * ).

      • (string) --
    • ExposeHeaders (list) --

      The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

      • (string) --
    • MaxAge (integer) --

      The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

Return type

dict

Returns

Response Syntax

{
    'FunctionUrl': 'string',
    'FunctionArn': 'string',
    'AuthType': 'NONE'|'AWS_IAM',
    'Cors': {
        'AllowCredentials': True|False,
        'AllowHeaders': [
            'string',
        ],
        'AllowMethods': [
            'string',
        ],
        'AllowOrigins': [
            'string',
        ],
        'ExposeHeaders': [
            'string',
        ],
        'MaxAge': 123
    },
    'CreationTime': 'string',
    'LastModifiedTime': 'string'
}

Response Structure

  • (dict) --

    • FunctionUrl (string) --

      The HTTP URL endpoint for your function.

    • FunctionArn (string) --

      The Amazon Resource Name (ARN) of your function.

    • AuthType (string) --

      The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

    • Cors (dict) --

      The cross-origin resource sharing (CORS) settings for your function URL.

      • AllowCredentials (boolean) --

        Whether to allow cookies or other credentials in requests to your function URL. The default is false .

      • AllowHeaders (list) --

        The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • AllowMethods (list) --

        The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

        • (string) --
      • AllowOrigins (list) --

        The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

        Alternatively, you can grant access to all origins using the wildcard character ( * ).

        • (string) --
      • ExposeHeaders (list) --

        The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

        • (string) --
      • MaxAge (integer) --

        The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

    • CreationTime (string) --

      When the function URL was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

    • LastModifiedTime (string) --

      When the function URL configuration was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

Exceptions

  • Lambda.Client.exceptions.ResourceConflictException
  • Lambda.Client.exceptions.ResourceNotFoundException
  • Lambda.Client.exceptions.InvalidParameterValueException
  • Lambda.Client.exceptions.ServiceException
  • Lambda.Client.exceptions.TooManyRequestsException

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 second version, 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.ListCodeSigningConfigs
paginator = client.get_paginator('list_code_signing_configs')
paginate(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
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
{
    'CodeSigningConfigs': [
        {
            'CodeSigningConfigId': 'string',
            'CodeSigningConfigArn': 'string',
            'Description': 'string',
            'AllowedPublishers': {
                'SigningProfileVersionArns': [
                    'string',
                ]
            },
            'CodeSigningPolicies': {
                'UntrustedArtifactOnDeployment': 'Warn'|'Enforce'
            },
            'LastModified': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --
    • CodeSigningConfigs (list) --

      The code signing configurations

      • (dict) --

        Details about a Code signing configuration.

        • CodeSigningConfigId (string) --

          Unique identifer for the Code signing configuration.

        • CodeSigningConfigArn (string) --

          The Amazon Resource Name (ARN) of the Code signing configuration.

        • Description (string) --

          Code signing configuration description.

        • AllowedPublishers (dict) --

          List of allowed publishers.

          • SigningProfileVersionArns (list) --

            The Amazon Resource Name (ARN) for each of the signing profiles. A signing profile defines a trusted user who can sign a code package.

            • (string) --
        • CodeSigningPolicies (dict) --

          The code signing policy controls the validation failure action for signature mismatch or expiry.

          • UntrustedArtifactOnDeployment (string) --

            Code signing configuration policy for deployment validation failure. If you set the policy to Enforce , Lambda blocks the deployment request if signature validation checks fail. If you set the policy to Warn , Lambda allows the deployment and creates a CloudWatch log.

            Default value: Warn

        • LastModified (string) --

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

    • 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.
    • Amazon Managed Streaming for Apache Kafka - The ARN of the cluster.
    • Amazon MQ - The ARN of the broker.
  • 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',
            'StartingPosition': 'TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
            'StartingPositionTimestamp': datetime(2015, 1, 1),
            'BatchSize': 123,
            'MaximumBatchingWindowInSeconds': 123,
            'ParallelizationFactor': 123,
            'EventSourceArn': 'string',
            'FilterCriteria': {
                'Filters': [
                    {
                        'Pattern': 'string'
                    },
                ]
            },
            'FunctionArn': 'string',
            'LastModified': datetime(2015, 1, 1),
            'LastProcessingResult': 'string',
            'State': 'string',
            'StateTransitionReason': 'string',
            'DestinationConfig': {
                'OnSuccess': {
                    'Destination': 'string'
                },
                'OnFailure': {
                    'Destination': 'string'
                }
            },
            'Topics': [
                'string',
            ],
            'Queues': [
                'string',
            ],
            'SourceAccessConfigurations': [
                {
                    'Type': 'BASIC_AUTH'|'VPC_SUBNET'|'VPC_SECURITY_GROUP'|'SASL_SCRAM_512_AUTH'|'SASL_SCRAM_256_AUTH'|'VIRTUAL_HOST'|'CLIENT_CERTIFICATE_TLS_AUTH'|'SERVER_ROOT_CA_CERTIFICATE',
                    'URI': 'string'
                },
            ],
            'SelfManagedEventSource': {
                'Endpoints': {
                    'string': [
                        'string',
                    ]
                }
            },
            'MaximumRecordAgeInSeconds': 123,
            'BisectBatchOnFunctionError': True|False,
            'MaximumRetryAttempts': 123,
            'TumblingWindowInSeconds': 123,
            'FunctionResponseTypes': [
                'ReportBatchItemFailures',
            ],
            'AmazonManagedKafkaEventSourceConfig': {
                'ConsumerGroupId': 'string'
            },
            'SelfManagedKafkaEventSourceConfig': {
                'ConsumerGroupId': 'string'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • EventSourceMappings (list) --

      A list of event source mappings.

      • (dict) --

        A mapping between an Amazon Web Services resource and a Lambda function. For details, see CreateEventSourceMapping.

        • UUID (string) --

          The identifier of the event source mapping.

        • StartingPosition (string) --

          The position in a stream from which to start reading. Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK stream sources. AT_TIMESTAMP is supported only for Amazon Kinesis streams.

        • StartingPositionTimestamp (datetime) --

          With StartingPosition set to AT_TIMESTAMP , the time from which to start reading.

        • BatchSize (integer) --

          The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).

          Default value: Varies by service. For Amazon SQS, the default is 10. For all other services, the default is 100.

          Related setting: When you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

        • MaximumBatchingWindowInSeconds (integer) --

          The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. You can configure MaximumBatchingWindowInSeconds to any value from 0 seconds to 300 seconds in increments of seconds.

          For streams and Amazon SQS event sources, the default batching window is 0 seconds. For Amazon MSK, Self-managed Apache Kafka, and Amazon MQ event sources, the default batching window is 500 ms. Note that because you can only change MaximumBatchingWindowInSeconds in increments of seconds, you cannot revert back to the 500 ms default batching window after you have changed it. To restore the default batching window, you must create a new event source mapping.

          Related setting: For streams and Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.

        • ParallelizationFactor (integer) --

          (Streams only) The number of batches to process concurrently from each shard. The default value is 1.

        • EventSourceArn (string) --

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

        • FilterCriteria (dict) --

          An object that defines the filter criteria that determine whether Lambda should process an event. For more information, see Lambda event filtering.

          • Filters (list) --

            A list of filters.

            • (dict) --

              A structure within a FilterCriteria object that defines an event filtering pattern.

              • Pattern (string) --

                A filter pattern. For more information on the syntax of a filter pattern, see Filter rule syntax.

        • FunctionArn (string) --

          The ARN of the Lambda function.

        • LastModified (datetime) --

          The date that the event source mapping was last updated or that its state changed.

        • LastProcessingResult (string) --

          The result of the last Lambda invocation of your 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) --

          Indicates whether a user or Lambda made the last change to the event source mapping.

        • DestinationConfig (dict) --

          (Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.

          • OnSuccess (dict) --

            The destination configuration for successful invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

          • OnFailure (dict) --

            The destination configuration for failed invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

        • Topics (list) --

          The name of the Kafka topic.

          • (string) --
        • Queues (list) --

          (Amazon MQ) The name of the Amazon MQ broker destination queue to consume.

          • (string) --
        • SourceAccessConfigurations (list) --

          An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.

          • (dict) --

            To secure and define access to your event source, you can specify the authentication protocol, VPC components, or virtual host.

            • Type (string) --

              The type of authentication protocol, VPC components, or virtual host for your event source. For example: "Type":"SASL_SCRAM_512_AUTH" .

              • BASIC_AUTH - (Amazon MQ) The Secrets Manager secret that stores your broker credentials.
              • BASIC_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL/PLAIN authentication of your Apache Kafka brokers.
              • VPC_SUBNET - (Self-managed Apache Kafka) The subnets associated with your VPC. Lambda connects to these subnets to fetch data from your self-managed Apache Kafka cluster.
              • VPC_SECURITY_GROUP - (Self-managed Apache Kafka) The VPC security group used to manage access to your self-managed Apache Kafka brokers.
              • SASL_SCRAM_256_AUTH - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your self-managed Apache Kafka brokers.
              • SASL_SCRAM_512_AUTH - (Amazon MSK, Self-managed Apache Kafka) The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your self-managed Apache Kafka brokers.
              • VIRTUAL_HOST - (RabbitMQ) The name of the virtual host in your RabbitMQ broker. Lambda uses this RabbitMQ host as the event source. This property cannot be specified in an UpdateEventSourceMapping API call.
              • CLIENT_CERTIFICATE_TLS_AUTH - (Amazon MSK, self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the certificate chain (X.509 PEM), private key (PKCS#8 PEM), and private key password (optional) used for mutual TLS authentication of your MSK/Apache Kafka brokers.
              • SERVER_ROOT_CA_CERTIFICATE - (Self-managed Apache Kafka) The Secrets Manager ARN of your secret key containing the root CA certificate (X.509 PEM) used for TLS encryption of your Apache Kafka brokers.
            • URI (string) --

              The value for your chosen configuration in Type . For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName" .

        • SelfManagedEventSource (dict) --

          The self-managed Apache Kafka cluster for your event source.

          • Endpoints (dict) --

            The list of bootstrap servers for your Kafka brokers in the following format: "KAFKA_BOOTSTRAP_SERVERS": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"] .

            • (string) --
              • (list) --
                • (string) --
        • MaximumRecordAgeInSeconds (integer) --

          (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.

        • BisectBatchOnFunctionError (boolean) --

          (Streams only) If the function returns an error, split the batch in two and retry. The default value is false.

        • MaximumRetryAttempts (integer) --

          (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

        • TumblingWindowInSeconds (integer) --

          (Streams only) The duration in seconds of a processing window. The range is 1–900 seconds.

        • FunctionResponseTypes (list) --

          (Streams and Amazon SQS) A list of current response type enums applied to the event source mapping.

          • (string) --
        • AmazonManagedKafkaEventSourceConfig (dict) --

          Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.

          • ConsumerGroupId (string) --

            The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

        • SelfManagedKafkaEventSourceConfig (dict) --

          Specific configuration settings for a self-managed Apache Kafka event source.

          • ConsumerGroupId (string) --

            The identifier for the Kafka consumer group to join. The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. For more information, see Customizable consumer group ID.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListFunctionEventInvokeConfigs
paginator = client.get_paginator('list_function_event_invoke_configs')
paginate(**kwargs)

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

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 - 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.

  • 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

{
    'FunctionEventInvokeConfigs': [
        {
            'LastModified': datetime(2015, 1, 1),
            'FunctionArn': 'string',
            'MaximumRetryAttempts': 123,
            'MaximumEventAgeInSeconds': 123,
            'DestinationConfig': {
                'OnSuccess': {
                    'Destination': 'string'
                },
                'OnFailure': {
                    'Destination': 'string'
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • FunctionEventInvokeConfigs (list) --

      A list of configurations.

      • (dict) --

        • LastModified (datetime) --

          The date and time that the configuration was last updated.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of the function.

        • MaximumRetryAttempts (integer) --

          The maximum number of times to retry when the function returns an error.

        • MaximumEventAgeInSeconds (integer) --

          The maximum age of a request that Lambda sends to a function for processing.

        • DestinationConfig (dict) --

          A destination for events after they have been sent to a function for processing.

          Destinations

          • Function - The Amazon Resource Name (ARN) of a Lambda function.
          • Queue - The ARN of an SQS queue.
          • Topic - The ARN of an SNS topic.
          • Event Bus - The ARN of an Amazon EventBridge event bus.
          • OnSuccess (dict) --

            The destination configuration for successful invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

          • OnFailure (dict) --

            The destination configuration for failed invocations.

            • Destination (string) --

              The Amazon Resource Name (ARN) of the destination resource.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListFunctionUrlConfigs
paginator = client.get_paginator('list_function_url_configs')
paginate(**kwargs)

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

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 namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • 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

{
    'FunctionUrlConfigs': [
        {
            'FunctionUrl': 'string',
            'FunctionArn': 'string',
            'CreationTime': 'string',
            'LastModifiedTime': 'string',
            'Cors': {
                'AllowCredentials': True|False,
                'AllowHeaders': [
                    'string',
                ],
                'AllowMethods': [
                    'string',
                ],
                'AllowOrigins': [
                    'string',
                ],
                'ExposeHeaders': [
                    'string',
                ],
                'MaxAge': 123
            },
            'AuthType': 'NONE'|'AWS_IAM'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • FunctionUrlConfigs (list) --

      A list of function URL configurations.

      • (dict) --

        Details about a Lambda function URL.

        • FunctionUrl (string) --

          The HTTP URL endpoint for your function.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of your function.

        • CreationTime (string) --

          When the function URL was created, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • LastModifiedTime (string) --

          When the function URL configuration was last updated, in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sTZD).

        • Cors (dict) --

          The cross-origin resource sharing (CORS) settings for your function URL.

          • AllowCredentials (boolean) --

            Whether to allow cookies or other credentials in requests to your function URL. The default is false .

          • AllowHeaders (list) --

            The HTTP headers that origins can include in requests to your function URL. For example: Date , Keep-Alive , X-Custom-Header .

            • (string) --
          • AllowMethods (list) --

            The HTTP methods that are allowed when calling your function URL. For example: GET , POST , DELETE , or the wildcard character ( * ).

            • (string) --
          • AllowOrigins (list) --

            The origins that can access your function URL. You can list any number of specific origins, separated by a comma. For example: https://www.example.com , http://localhost:60905 .

            Alternatively, you can grant access to all origins using the wildcard character ( * ).

            • (string) --
          • ExposeHeaders (list) --

            The HTTP headers in your function response that you want to expose to origins that call your function URL. For example: Date , Keep-Alive , X-Custom-Header .

            • (string) --
          • MaxAge (integer) --

            The maximum amount of time, in seconds, that web browsers can cache results of a preflight request. By default, this is set to 0 , which means that the browser doesn't cache results.

        • AuthType (string) --

          The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated IAM users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs.

    • 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 Amazon Web Services Region of the master function. For example, us-east-1 filters the list of functions to include only Lambda@Edge functions replicated from a master function in US East (N. Virginia). 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            '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,
                    'SigningProfileVersionArn': 'string',
                    'SigningJobArn': 'string'
                },
            ],
            'State': 'Pending'|'Active'|'Inactive'|'Failed',
            'StateReason': 'string',
            'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
            'LastUpdateStatusReason': 'string',
            'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'FileSystemConfigs': [
                {
                    'Arn': 'string',
                    'LocalMountPath': 'string'
                },
            ],
            'PackageType': 'Zip'|'Image',
            'ImageConfigResponse': {
                'ImageConfig': {
                    'EntryPoint': [
                        'string',
                    ],
                    'Command': [
                        'string',
                    ],
                    'WorkingDirectory': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string',
            'Architectures': [
                'x86_64'|'arm64',
            ],
            'EphemeralStorage': {
                'Size': 123
            },
            'SnapStart': {
                'ApplyOn': 'PublishedVersions'|'None',
                'OptimizationStatus': 'On'|'Off'
            }
        },
    ],
    '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 running 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 in seconds that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The amount of memory available to the function at runtime.

        • 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 group 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. Omitted from CloudTrail logs.

          • Variables (dict) --

            Environment variable key-value pairs. Omitted from CloudTrail logs.

            • (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 returned only if you've configured a customer managed key.

        • TracingConfig (dict) --

          The function's X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

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

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers.

          • (dict) --

            An Lambda layer.

            • Arn (string) --

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

            • CodeSize (integer) --

              The size of the layer archive in bytes.

            • SigningProfileVersionArn (string) --

              The Amazon Resource Name (ARN) for a signing profile version.

            • SigningJobArn (string) --

              The Amazon Resource Name (ARN) of a signing job.

        • State (string) --

          The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

        • StateReason (string) --

          The reason for the function's current state.

        • StateReasonCode (string) --

          The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

        • LastUpdateStatus (string) --

          The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

        • LastUpdateStatusReason (string) --

          The reason for the last update that was performed on the function.

        • LastUpdateStatusReasonCode (string) --

          The reason code for the last update that was performed on the function.

        • FileSystemConfigs (list) --

          Connection settings for an Amazon EFS file system.

          • (dict) --

            Details about the connection between a Lambda function and an Amazon EFS file system.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

            • LocalMountPath (string) --

              The path where the function can access the file system, starting with /mnt/ .

        • PackageType (string) --

          The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

        • ImageConfigResponse (dict) --

          The function's image configuration values.

          • ImageConfig (dict) --

            Configuration values that override the container image Dockerfile.

            • EntryPoint (list) --

              Specifies the entry point to their application, which is typically the location of the runtime executable.

              • (string) --
            • Command (list) --

              Specifies parameters that you want to pass in with ENTRYPOINT.

              • (string) --
            • WorkingDirectory (string) --

              Specifies the working directory.

          • Error (dict) --

            Error response to GetFunctionConfiguration .

            • ErrorCode (string) --

              Error code.

            • Message (string) --

              Error message.

        • SigningProfileVersionArn (string) --

          The ARN of the signing profile version.

        • SigningJobArn (string) --

          The ARN of the signing job.

        • Architectures (list) --

          The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

          • (string) --
        • EphemeralStorage (dict) --

          The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

          • Size (integer) --

            The size of the function's /tmp directory.

        • SnapStart (dict) --

          Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

          • ApplyOn (string) --

            When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

          • OptimizationStatus (string) --

            When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListFunctionsByCodeSigningConfig
paginator = client.get_paginator('list_functions_by_code_signing_config')
paginate(**kwargs)

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

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The The Amazon Resource Name (ARN) of the code signing configuration.

  • 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

{
    'FunctionArns': [
        'string',
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • FunctionArns (list) --

      The function ARNs.

      • (string) --
    • 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    LayerName='string',
    CompatibleArchitecture='x86_64'|'arm64',
    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.

  • CompatibleArchitecture (string) -- The compatible instruction set architecture.
  • 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            ],
            'LicenseInfo': 'string',
            'CompatibleArchitectures': [
                'x86_64'|'arm64',
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • LayerVersions (list) --

      A list of versions.

      • (dict) --

        Details about a version of an 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.

        • CompatibleArchitectures (list) --

          A list of compatible instruction set architectures.

          • (string) --
    • 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
    CompatibleArchitecture='x86_64'|'arm64',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • CompatibleRuntime (string) -- A runtime identifier. For example, go1.x .
  • CompatibleArchitecture (string) -- The compatible instruction set architecture.
  • 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
                ],
                'LicenseInfo': 'string',
                'CompatibleArchitectures': [
                    'x86_64'|'arm64',
                ]
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Layers (list) --

      A list of function layers.

      • (dict) --

        Details about an 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.

          • CompatibleArchitectures (list) --

            A list of compatible instruction set architectures.

            • (string) --
    • NextToken (string) --

      A token to resume pagination.

class Lambda.Paginator.ListProvisionedConcurrencyConfigs
paginator = client.get_paginator('list_provisioned_concurrency_configs')
paginate(**kwargs)

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

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 namemy-function .
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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.

  • 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

{
    'ProvisionedConcurrencyConfigs': [
        {
            'FunctionArn': 'string',
            'RequestedProvisionedConcurrentExecutions': 123,
            'AvailableProvisionedConcurrentExecutions': 123,
            'AllocatedProvisionedConcurrentExecutions': 123,
            'Status': 'IN_PROGRESS'|'READY'|'FAILED',
            'StatusReason': 'string',
            'LastModified': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ProvisionedConcurrencyConfigs (list) --

      A list of provisioned concurrency configurations.

      • (dict) --

        Details about the provisioned concurrency configuration for a function alias or version.

        • FunctionArn (string) --

          The Amazon Resource Name (ARN) of the alias or version.

        • RequestedProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency requested.

        • AvailableProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency available.

        • AllocatedProvisionedConcurrentExecutions (integer) --

          The amount of provisioned concurrency allocated. When a weighted alias is used during linear and canary deployments, this value fluctuates depending on the amount of concurrency that is provisioned for the function versions.

        • Status (string) --

          The status of the allocation process.

        • StatusReason (string) --

          For failed allocations, the reason that provisioned concurrency could not be allocated.

        • LastModified (string) --

          The date and time that a user last updated the configuration, in ISO 8601 format.

    • 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'|'nodejs12.x'|'nodejs14.x'|'nodejs16.x'|'java8'|'java8.al2'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'python3.9'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'dotnet6'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided'|'provided.al2'|'nodejs18.x',
            '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,
                    'SigningProfileVersionArn': 'string',
                    'SigningJobArn': 'string'
                },
            ],
            'State': 'Pending'|'Active'|'Inactive'|'Failed',
            'StateReason': 'string',
            'StateReasonCode': 'Idle'|'Creating'|'Restoring'|'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'LastUpdateStatus': 'Successful'|'Failed'|'InProgress',
            'LastUpdateStatusReason': 'string',
            'LastUpdateStatusReasonCode': 'EniLimitExceeded'|'InsufficientRolePermissions'|'InvalidConfiguration'|'InternalError'|'SubnetOutOfIPAddresses'|'InvalidSubnet'|'InvalidSecurityGroup'|'ImageDeleted'|'ImageAccessDenied'|'InvalidImage'|'KMSKeyAccessDenied'|'KMSKeyNotFound'|'InvalidStateKMSKey'|'DisabledKMSKey'|'EFSIOError'|'EFSMountConnectivityError'|'EFSMountFailure'|'EFSMountTimeout'|'InvalidRuntime'|'InvalidZipFileException'|'FunctionError',
            'FileSystemConfigs': [
                {
                    'Arn': 'string',
                    'LocalMountPath': 'string'
                },
            ],
            'PackageType': 'Zip'|'Image',
            'ImageConfigResponse': {
                'ImageConfig': {
                    'EntryPoint': [
                        'string',
                    ],
                    'Command': [
                        'string',
                    ],
                    'WorkingDirectory': 'string'
                },
                'Error': {
                    'ErrorCode': 'string',
                    'Message': 'string'
                }
            },
            'SigningProfileVersionArn': 'string',
            'SigningJobArn': 'string',
            'Architectures': [
                'x86_64'|'arm64',
            ],
            'EphemeralStorage': {
                'Size': 123
            },
            'SnapStart': {
                'ApplyOn': 'PublishedVersions'|'None',
                'OptimizationStatus': 'On'|'Off'
            }
        },
    ],
    '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 running 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 in seconds that Lambda allows a function to run before stopping it.

        • MemorySize (integer) --

          The amount of memory available to the function at runtime.

        • 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 group 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. Omitted from CloudTrail logs.

          • Variables (dict) --

            Environment variable key-value pairs. Omitted from CloudTrail logs.

            • (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 returned only if you've configured a customer managed key.

        • TracingConfig (dict) --

          The function's X-Ray tracing configuration.

          • Mode (string) --

            The tracing mode.

        • MasterArn (string) --

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

        • RevisionId (string) --

          The latest updated revision of the function or alias.

        • Layers (list) --

          The function's layers.

          • (dict) --

            An Lambda layer.

            • Arn (string) --

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

            • CodeSize (integer) --

              The size of the layer archive in bytes.

            • SigningProfileVersionArn (string) --

              The Amazon Resource Name (ARN) for a signing profile version.

            • SigningJobArn (string) --

              The Amazon Resource Name (ARN) of a signing job.

        • State (string) --

          The current state of the function. When the state is Inactive , you can reactivate the function by invoking it.

        • StateReason (string) --

          The reason for the function's current state.

        • StateReasonCode (string) --

          The reason code for the function's current state. When the code is Creating , you can't invoke or modify the function.

        • LastUpdateStatus (string) --

          The status of the last update that was performed on the function. This is first set to Successful after function creation completes.

        • LastUpdateStatusReason (string) --

          The reason for the last update that was performed on the function.

        • LastUpdateStatusReasonCode (string) --

          The reason code for the last update that was performed on the function.

        • FileSystemConfigs (list) --

          Connection settings for an Amazon EFS file system.

          • (dict) --

            Details about the connection between a Lambda function and an Amazon EFS file system.

            • Arn (string) --

              The Amazon Resource Name (ARN) of the Amazon EFS access point that provides access to the file system.

            • LocalMountPath (string) --

              The path where the function can access the file system, starting with /mnt/ .

        • PackageType (string) --

          The type of deployment package. Set to Image for container image and set Zip for .zip file archive.

        • ImageConfigResponse (dict) --

          The function's image configuration values.

          • ImageConfig (dict) --

            Configuration values that override the container image Dockerfile.

            • EntryPoint (list) --

              Specifies the entry point to their application, which is typically the location of the runtime executable.

              • (string) --
            • Command (list) --

              Specifies parameters that you want to pass in with ENTRYPOINT.

              • (string) --
            • WorkingDirectory (string) --

              Specifies the working directory.

          • Error (dict) --

            Error response to GetFunctionConfiguration .

            • ErrorCode (string) --

              Error code.

            • Message (string) --

              Error message.

        • SigningProfileVersionArn (string) --

          The ARN of the signing profile version.

        • SigningJobArn (string) --

          The ARN of the signing job.

        • Architectures (list) --

          The instruction set architecture that the function supports. Architecture is a string array with one of the valid values. The default architecture value is x86_64 .

          • (string) --
        • EphemeralStorage (dict) --

          The size of the function’s /tmp directory in MB. The default value is 512, but it can be any whole number between 512 and 10,240 MB.

          • Size (integer) --

            The size of the function's /tmp directory.

        • SnapStart (dict) --

          Set ApplyOn to PublishedVersions to create a snapshot of the initialized execution environment when you publish a function version. For more information, see Reducing startup time with Lambda SnapStart.

          • ApplyOn (string) --

            When set to PublishedVersions , Lambda creates a snapshot of the execution environment when you publish a function version.

          • OptimizationStatus (string) --

            When you provide a qualified Amazon Resource Name (ARN), this response element indicates whether SnapStart is activated for the specified function version.

    • NextToken (string) --

      A token to resume pagination.

Waiters

The available waiters are:

class Lambda.Waiter.FunctionActive
waiter = client.get_waiter('function_active')
wait(**kwargs)

Polls Lambda.Client.get_function_configuration() every 5 seconds until a successful state is reached. An error is returned after 60 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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: 5

    • MaxAttempts (integer) --

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

Returns

None

class Lambda.Waiter.FunctionActiveV2
waiter = client.get_waiter('function_active_v2')
wait(**kwargs)

Polls Lambda.Client.get_function() every 1 seconds until a successful state is reached. An error is returned after 300 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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: 300

Returns

None

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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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

class Lambda.Waiter.FunctionUpdated
waiter = client.get_waiter('function_updated')
wait(**kwargs)

Polls Lambda.Client.get_function_configuration() every 5 seconds until a successful state is reached. An error is returned after 60 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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: 5

    • MaxAttempts (integer) --

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

Returns

None

class Lambda.Waiter.FunctionUpdatedV2
waiter = client.get_waiter('function_updated_v2')
wait(**kwargs)

Polls Lambda.Client.get_function() every 1 seconds until a successful state is reached. An error is returned after 300 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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: 300

Returns

None

class Lambda.Waiter.PublishedVersionActive
waiter = client.get_waiter('published_version_active')
wait(**kwargs)

Polls Lambda.Client.get_function_configuration() every 5 seconds until a successful state is reached. An error is returned after 312 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 namemy-function (name-only), my-function:v1 (with alias).
    • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function .
    • Partial ARN123456789012: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: 5

    • MaxAttempts (integer) --

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

Returns

None