class S3CodeV2
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Lambda.S3CodeV2 |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#S3CodeV2 |
Java | software.amazon.awscdk.services.lambda.S3CodeV2 |
Python | aws_cdk.aws_lambda.S3CodeV2 |
TypeScript (source) | aws-cdk-lib » aws_lambda » S3CodeV2 |
Extends
Code
Lambda code from an S3 archive.
With option to set KMSKey for encryption.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
declare const bucket: s3.Bucket;
declare const keyRef: kms.IKeyRef;
const s3CodeV2 = new lambda.S3CodeV2(bucket, 'key', /* all optional props */ {
objectVersion: 'objectVersion',
sourceKMSKey: keyRef,
});
Initializer
new S3CodeV2(bucket: IBucket, key: string, options?: BucketOptions)
Parameters
- bucket
IBucket - key
string - options
BucketOptions
Properties
| Name | Type | Description |
|---|---|---|
| is | boolean | Determines whether this Code is inline code or not. |
isInline
Type:
boolean
Determines whether this Code is inline code or not.
Methods
| Name | Description |
|---|---|
| bind(_scope) | Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun. |
| bind | Called after the CFN function resource has been created to allow the code class to bind to it. |
bind(_scope)
public bind(_scope: Construct): CodeConfig
Parameters
- _scope
Construct
Returns
Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
bindToResource(_resource, _options?)
public bindToResource(_resource: CfnResource, _options?: ResourceBindOptions): void
Parameters
- _resource
CfnResource - _options
ResourceBind Options
Called after the CFN function resource has been created to allow the code class to bind to it.
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.

.NET
Go
Java
Python
TypeScript (