AWS Lambda

2017/05/04 - AWS Lambda - 1 updated api methods

Changes  Support for UpdateFunctionCode DryRun option

UpdateFunctionCode (updated) Link ΒΆ
Changes (request)
{'DryRun': 'boolean'}

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

If you are using the versioning feature, note this API will always update the $LATEST version of your Lambda function. For information about the versioning feature, see AWS Lambda Function Versioning and Aliases.

This operation requires permission for the lambda:UpdateFunctionCode action.

See also: AWS API Documentation

Request Syntax

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

string

param FunctionName

[REQUIRED]

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

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

type ZipFile

bytes

param ZipFile

The contents of your zip file containing your deployment package. If you are using the web API directly, the contents of the zip file must be base64-encoded. If you are using the AWS SDKs or the AWS CLI, the SDKs or CLI will do the encoding for you. For more information about creating a .zip file, see Execution Permissions in the AWS Lambda Developer Guide .

type S3Bucket

string

param S3Bucket

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

type S3Key

string

param S3Key

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

type S3ObjectVersion

string

param S3ObjectVersion

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

type Publish

boolean

param Publish

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

type DryRun

boolean

param DryRun

This boolean parameter can be used to test your request to AWS Lambda to update the Lambda function and publish a version as an atomic operation. It will do all necessary computation and validation of your code but will not upload it or a publish a version. Each time this operation is invoked, the CodeSha256 hash value the provided code will also be computed and returned in the response.

rtype

dict

returns

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs'|'nodejs4.3'|'nodejs6.10'|'java8'|'python2.7'|'python3.6'|'dotnetcore1.0'|'nodejs4.3-edge',
    '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'
    }
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

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

    • FunctionArn (string) --

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

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

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

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

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

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

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

    • MemorySize (integer) --

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

    • LastModified (string) --

      The time stamp of the last time you updated the function.

    • CodeSha256 (string) --

      It is the SHA256 hash of your function deployment package.

    • Version (string) --

      The version of the Lambda function.

    • VpcConfig (dict) --

      VPC configuration associated with your Lambda function.

      • SubnetIds (list) --

        A list of subnet IDs associated with the Lambda function.

        • (string) --

      • SecurityGroupIds (list) --

        A list of security group IDs associated with the Lambda function.

        • (string) --

      • VpcId (string) --

        The VPC ID associated with you Lambda function.

    • DeadLetterConfig (dict) --

      The parent object that contains the target ARN (Amazon Resource Name) of an Amazon SQS queue or Amazon SNS topic.

      • TargetArn (string) --

        The Amazon Resource Name (ARN) of an Amazon SQS queue or Amazon SNS topic you specify as your Dead Letter Queue (DLQ).

    • Environment (dict) --

      The parent object that contains your environment's configuration settings.

      • Variables (dict) --

        The key-value pairs returned that represent your environment's configuration settings or error information.

        • (string) --

          • (string) --

      • Error (dict) --

        The parent object that contains error information associated with your configuration settings.

        • ErrorCode (string) --

          The error code returned by the environment error object.

        • Message (string) --

          The message returned by the environment error object.

    • KMSKeyArn (string) --

      The Amazon Resource Name (ARN) of the KMS key used to encrypt your function's environment variables. If empty, it means you are using the AWS Lambda default service key.

    • TracingConfig (dict) --

      The parent object that contains your function's tracing settings.

      • Mode (string) --

        The tracing mode associated with your Lambda function.