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.104.0 (build e79254c)", date="2024-11-22T02:24:08.950Z") @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
  • 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.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString

    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
  • 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.