Class S3CodeV2

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.Code
software.amazon.awscdk.services.lambda.S3CodeV2
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.140.0 (build 79fd58c)", date="2026-09-25T13:53:53.447Z") @Stability(Stable) public class 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 software.amazon.awscdk.services.lambda.*;
 import software.amazon.awscdk.services.s3.*;
 import software.amazon.awscdk.interfaces.kms.*;
 Bucket bucket;
 IKeyRef keyRef;
 S3CodeV2 s3CodeV2 = S3CodeV2.Builder.create(bucket, "key")
         .objectVersion("objectVersion")
         .s3ObjectStorageMode(S3ObjectStorageMode.COPY)
         .sourceKMSKey(keyRef)
         .build();
 
  • Constructor Details

    • S3CodeV2

      protected S3CodeV2(software.amazon.jsii.JsiiObjectRef objRef)
    • S3CodeV2

      protected S3CodeV2(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • S3CodeV2

      @Stability(Stable) public S3CodeV2(@NotNull IBucket bucket, @NotNull String key, @Nullable BucketOptions options)
      Parameters:
      bucket - This parameter is required.
      key - This parameter is required.
      options -
    • S3CodeV2

      @Stability(Stable) public S3CodeV2(@NotNull IBucket bucket, @NotNull String key)
      Parameters:
      bucket - This parameter is required.
      key - This parameter is required.
  • Method Details

    • bind

      @Stability(Stable) @NotNull public CodeConfig bind(@NotNull software.constructs.Construct _scope)
      Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.

      Specified by:
      bind in class Code
      Parameters:
      _scope - This parameter is required.
    • bindToResource

      @Stability(Stable) public void bindToResource(@NotNull CfnResource resource, @Nullable ResourceBindOptions _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.

      Overrides:
      bindToResource in class Code
      Parameters:
      resource - This parameter is required.
      _options -
    • bindToResource

      @Stability(Stable) public void bindToResource(@NotNull CfnResource resource)
      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.

      Overrides:
      bindToResource in class Code
      Parameters:
      resource - This parameter is required.
    • getIsInline

      @Stability(Stable) @NotNull public Boolean getIsInline()
      Determines whether this Code is inline code or not.