Class BucketDeployment

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.s3.deployment.BucketDeployment
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable
Direct Known Subclasses:
DeployTimeSubstitutedFile

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-10T17:51:53.455Z") @Stability(Stable) public class BucketDeployment extends software.constructs.Construct
BucketDeployment populates an S3 bucket with the contents of .zip files from other S3 buckets or from local disk.

Example:

 Bucket destinationBucket;
 BucketDeployment deployment = BucketDeployment.Builder.create(this, "DeployFiles")
         .sources(List.of(Source.asset(join(__dirname, "source-files"))))
         .destinationBucket(destinationBucket)
         .build();
 deployment.handlerRole.addToPolicy(
 PolicyStatement.Builder.create()
         .actions(List.of("kms:Decrypt", "kms:DescribeKey"))
         .effect(Effect.ALLOW)
         .resources(List.of("<encryption key ARN>"))
         .build());
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for BucketDeployment.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.constructs.IConstruct

    software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Uniquely identifies this class.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    BucketDeployment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    BucketDeployment(software.amazon.jsii.JsiiObjectRef objRef)
     
     
    BucketDeployment(software.constructs.Construct scope, String id, BucketDeploymentProps props)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add an additional source to the bucket deployment.
    The bucket after the deployment.
    Execution role of the Lambda function behind the custom CloudFormation resource of type Custom::CDKBucketDeployment.
    The object keys for the sources deployed to the S3 bucket.
    The S3 version IDs of the objects deployed to the destination bucket.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString, with

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • BucketDeployment

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

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

      @Stability(Stable) public BucketDeployment(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull BucketDeploymentProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • addSource

      @Stability(Stable) public void addSource(@NotNull ISource source)
      Add an additional source to the bucket deployment.

      Example:

       IBucket websiteBucket;
       BucketDeployment deployment = BucketDeployment.Builder.create(this, "Deployment")
               .sources(List.of(Source.asset("./website-dist")))
               .destinationBucket(websiteBucket)
               .build();
       deployment.addSource(Source.asset("./another-asset"));
       

      Parameters:
      source - This parameter is required.
    • getDeployedBucket

      @Stability(Stable) @NotNull public IBucket getDeployedBucket()
      The bucket after the deployment.

      If you want to reference the destination bucket in another construct and make sure the bucket deployment has happened before the next operation is started, pass the other construct a reference to deployment.deployedBucket.

      Note that this only returns an immutable reference to the destination bucket. If sequenced access to the original destination bucket is required, you may add a dependency on the bucket deployment instead: otherResource.node.addDependency(deployment)

    • getHandlerRole

      @Stability(Stable) @NotNull public IRole getHandlerRole()
      Execution role of the Lambda function behind the custom CloudFormation resource of type Custom::CDKBucketDeployment.
    • getObjectKeys

      @Stability(Stable) @NotNull public List<String> getObjectKeys()
      The object keys for the sources deployed to the S3 bucket.

      This returns a list of tokenized object keys for source files that are deployed to the bucket.

      This can be useful when using BucketDeployment with extract set to false and you need to reference the object key that resides in the bucket for that zip source file somewhere else in your CDK application, such as in a CFN output.

      For example, use Fn.select(0, myBucketDeployment.objectKeys) to reference the object key of the first source file in your bucket deployment.

    • getObjectVersionIds

      @Stability(Stable) @NotNull public List<String> getObjectVersionIds()
      The S3 version IDs of the objects deployed to the destination bucket.

      Returns a list of tokenized version IDs, positionally matching objectKeys: the version ID at a given index corresponds to the object key at the same index.

      This is useful when a consumer must reference a specific, immutable version of a deployed object — for example a Lambda function that references its code in S3 by version rather than copying it.

      Requires versioning to be enabled on the destination bucket; otherwise the returned version IDs will be empty strings. Only supported with extract set to false, where each source zip maps 1:1 to a destination object. Reading this accessor with extract set to true (the default) throws. It also requires outputObjectKeys to remain enabled (the default), since the returned list is defined to be positionally aligned with objectKeys; reading it with outputObjectKeys set to false throws.