Skip to content
v2.273.0

BucketOptions Struct ​

Optional parameters for creating code using bucket.

Example ​

ts

import { Key } from 'aws-cdk-lib/aws-kms';
import * as s3 from 'aws-cdk-lib/aws-s3';

const bucket = new s3.Bucket(this, 'Bucket');
declare const key: Key;

const options = {
    sourceKMSKey: key,
};
const fnBucket = new lambda.Function(this, 'myFunction2', {
    runtime: lambda.Runtime.NODEJS_LATEST,
    handler: 'index.handler',
    code: lambda.Code.fromBucketV2(bucket, 'python-lambda-handler.zip', options),
});

Properties ​

objectVersionstringobject_versionstrobjectVersionStringObjectVersionstringObjectVersion*string= no object version#
Optional S3 object version.

Required when s3ObjectStorageMode is set to S3ObjectStorageMode.REFERENCE.

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.

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

Used as props by ​