Class BucketDeployment
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
- Direct Known Subclasses:
DeployTimeSubstitutedFile
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/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
ModifierConstructorDescriptionprotected
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 TypeMethodDescriptionvoid
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 typeCustom::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
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
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
Execution role of the Lambda function behind the custom CloudFormation resource of typeCustom::CDKBucketDeployment
. -
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
withextract
set tofalse
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.
-