Skip to content
v2.273.0

CodeConfig Struct ​

Result of binding Code into a Function.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';
const codeConfig: lambda.CodeConfig = {
  image: {
    imageUri: 'imageUri',

    // the properties below are optional
    cmd: ['cmd'],
    entrypoint: ['entrypoint'],
    workingDirectory: 'workingDirectory',
  },
  inlineCode: 'inlineCode',
  s3Location: {
    bucketName: 'bucketName',
    objectKey: 'objectKey',

    // the properties below are optional
    objectVersion: 'objectVersion',
  },
  s3ObjectStorageMode: lambda.S3ObjectStorageMode.COPY,
  sourceKMSKeyArn: 'sourceKMSKeyArn',
};

Properties ​

imageCodeImageConfigimageCodeImageConfigimageCodeImageConfigImageCodeImageConfigImageCodeImageConfig= code is not an ECR container ima…#
Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`).
default

Default: code is not an ECR container image

inlineCodestringinline_codestrinlineCodeStringInlineCodestringInlineCode*string= code is not inline code#
Inline code (mutually exclusive with `s3Location` and `image`).
s3LocationLocations3_locationLocations3LocationLocationS3LocationLocationS3LocationLocation= code is not an s3 location#
The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).
s3ObjectStorageModeS3ObjectStorageModes3_object_storage_modeS3ObjectStorageModes3ObjectStorageModeS3ObjectStorageModeS3ObjectStorageModeS3ObjectStorageModeS3ObjectStorageModeS3ObjectStorageMode= Lambda copies the deployment pac…#
How Lambda manages the storage of your code package.
default

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

sourceKMSKeyArnstringsource_kms_key_arnstrsourceKMSKeyArnStringSourceKMSKeyArnstringSourceKMSKeyArn*string= Lambda uses an AWS owned key#
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.