# CodeConfig

Result of binding `Code` into a `Function`.

- Source: [`aws-lambda/lib/code.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-lambda/lib/code.ts#L247)
- Type last changed: v2.271.0 · 25 Sep 2026

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

- `image`: [CodeImageConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.CodeImageConfig.html) — Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`).

  **Default:** code is not an ECR container image

- `inlineCode`: string — Inline code (mutually exclusive with `s3Location` and `image`).

  **Default:** code is not inline code

- `s3Location`: [Location](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Location.html) — The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).

  **Default:** code is not an s3 location

- `s3ObjectStorageMode`: [S3ObjectStorageMode](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.S3ObjectStorageMode.html) — How Lambda manages the storage of your code package.

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

- `sourceKMSKeyArn`: string — The ARN of the KMS key that Lambda uses to encrypt the deployment package in Lambda-managed storage.

  **Default:** Lambda uses an AWS owned key

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