AWS Lambda

2015/05/28 - AWS Lambda - 2 updated api methods

CreateFunction (updated) Link ¶
Changes (request)
{'Code': {'S3Bucket': 'string', 'S3Key': 'string', 'S3ObjectVersion': 'string'}}

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

This operation requires permission for the lambda:CreateFunction action.

Request Syntax

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

string

param FunctionName:

[REQUIRED]

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

type Runtime:

string

param Runtime:

[REQUIRED]

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

type Role:

string

param Role:

[REQUIRED]

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

type Handler:

string

param Handler:

[REQUIRED]

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

type Description:

string

param Description:

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

type Timeout:

integer

param Timeout:

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

type MemorySize:

integer

param MemorySize:

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

type Code:

dict

param Code:

[REQUIRED]

A structure that includes ZipFile.

  • ZipFile (bytes) --

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

  • S3Bucket (string) --

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

  • S3Key (string) --

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

  • S3ObjectVersion (string) --

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

rtype:

dict

returns:

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

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

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

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

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

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

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

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

    • MemorySize (integer) --

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

    • LastModified (string) --

      The timestamp of the last time you updated the function.

UpdateFunctionCode (updated) Link ¶
Changes (request)
{'S3Bucket': 'string', 'S3Key': 'string', 'S3ObjectVersion': 'string'}

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

This operation requires permission for the lambda:UpdateFunctionCode action.

Request Syntax

client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string'
)
type FunctionName:

string

param FunctionName:

[REQUIRED]

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

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

type ZipFile:

bytes

param ZipFile:

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

type S3Bucket:

string

param S3Bucket:

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

type S3Key:

string

param S3Key:

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

type S3ObjectVersion:

string

param S3ObjectVersion:

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

rtype:

dict

returns:

Response Syntax

{
    'FunctionName': 'string',
    'FunctionArn': 'string',
    'Runtime': 'nodejs',
    'Role': 'string',
    'Handler': 'string',
    'CodeSize': 123,
    'Description': 'string',
    'Timeout': 123,
    'MemorySize': 123,
    'LastModified': 'string'
}

Response Structure

  • (dict) --

    A complex type that describes function metadata.

    • FunctionName (string) --

      The name of the function.

    • FunctionArn (string) --

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

    • Runtime (string) --

      The runtime environment for the Lambda function.

    • Role (string) --

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

    • Handler (string) --

      The function Lambda calls to begin executing your function.

    • CodeSize (integer) --

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

    • Description (string) --

      The user-provided description.

    • Timeout (integer) --

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

    • MemorySize (integer) --

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

    • LastModified (string) --

      The timestamp of the last time you updated the function.