CodeConfig

class aws_cdk.aws_lambda.CodeConfig(*, image=None, inline_code=None, s3_location=None, s3_object_storage_mode=None, source_kms_key_arn=None)

Bases: object

Result of binding Code into a Function.

Parameters:
  • image (Union[CodeImageConfig, Dict[str, Any], None]) – Docker image configuration (mutually exclusive with s3Location and inlineCode). Default: - code is not an ECR container image

  • inline_code (Optional[str]) – Inline code (mutually exclusive with s3Location and image). Default: - code is not inline code

  • s3_location (Union[Location, Dict[str, Any], None]) – The location of the code in S3 (mutually exclusive with inlineCode and image). Default: - code is not an s3 location

  • s3_object_storage_mode (Optional[S3ObjectStorageMode]) – How Lambda manages the storage of your code package. Default: - Lambda copies the deployment package from your S3 bucket into Lambda-managed storage.

  • source_kms_key_arn (Optional[str]) – The ARN of the KMS key that Lambda uses to encrypt the deployment package in Lambda-managed storage. This is not the key used to encrypt the source object in Amazon S3. Default: - Lambda uses an AWS owned key

ExampleMetadata:

fixture=_generated

Example:

from aws_cdk.aws_s3 import Location
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lambda as lambda_

code_config = lambda.CodeConfig(
    image=lambda.CodeImageConfig(
        image_uri="imageUri",

        # the properties below are optional
        cmd=["cmd"],
        entrypoint=["entrypoint"],
        working_directory="workingDirectory"
    ),
    inline_code="inlineCode",
    s3_location=Location(
        bucket_name="bucketName",
        object_key="objectKey",

        # the properties below are optional
        object_version="objectVersion"
    ),
    s3_object_storage_mode=lambda_.S3ObjectStorageMode.COPY,
    source_kms_key_arn="sourceKMSKeyArn"
)

Attributes

image

Docker image configuration (mutually exclusive with s3Location and inlineCode).

Default:
  • code is not an ECR container image

inline_code

Inline code (mutually exclusive with s3Location and image).

Default:
  • code is not inline code

s3_location

The location of the code in S3 (mutually exclusive with inlineCode and image).

Default:
  • code is not an s3 location

s3_object_storage_mode

How Lambda manages the storage of your code package.

Default:
  • Lambda copies the deployment package from your S3 bucket into Lambda-managed storage.

source_kms_key_arn

The ARN of the KMS key that Lambda uses to encrypt the deployment package in Lambda-managed storage.

This is not the key used to encrypt the source object in Amazon S3.

Default:
  • Lambda uses an AWS owned key