Class BucketDeployment
BucketDeployment
populates an S3 bucket with the contents of .zip files from other S3 buckets or from local disk.
Namespace: Amazon.CDK.AWS.S3.Deployment
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BucketDeployment : Construct
Syntax (vb)
Public Class BucketDeployment
Inherits Construct
Remarks
ExampleMetadata: infused
Examples
Bucket websiteBucket;
var deployment = new BucketDeployment(this, "DeployWebsite", new BucketDeploymentProps {
Sources = new [] { Source.Asset(Join(__dirname, "my-website")) },
DestinationBucket = websiteBucket
});
new ConstructThatReadsFromTheBucket(this, "Consumer", new Dictionary<string, IBucket> {
// Use 'deployment.deployedBucket' instead of 'websiteBucket' here
{ "bucket", deployment.DeployedBucket }
});
Synopsis
Constructors
BucketDeployment(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
BucketDeployment(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
BucketDeployment(Construct, String, IBucketDeploymentProps) |
Properties
DeployedBucket | The bucket after the deployment. |
HandlerRole | Execution role of the Lambda function behind the custom CloudFormation resource of type |
ObjectKeys | The object keys for the sources deployed to the S3 bucket. |
Methods
AddSource(ISource) | Add an additional source to the bucket deployment. |
Constructors
BucketDeployment(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected BucketDeployment(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
BucketDeployment(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected BucketDeployment(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
BucketDeployment(Construct, String, IBucketDeploymentProps)
public BucketDeployment(Construct scope, string id, IBucketDeploymentProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IBucketDeploymentProps
Properties
DeployedBucket
The bucket after the deployment.
public virtual IBucket DeployedBucket { get; }
Property Value
Remarks
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)
HandlerRole
Execution role of the Lambda function behind the custom CloudFormation resource of type Custom::CDKBucketDeployment
.
public virtual IRole HandlerRole { get; }
Property Value
ObjectKeys
The object keys for the sources deployed to the S3 bucket.
public virtual string[] ObjectKeys { get; }
Property Value
System.String[]
Remarks
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.
Methods
AddSource(ISource)
Add an additional source to the bucket deployment.
public virtual void AddSource(ISource source)
Parameters
- source ISource
Examples
IBucket websiteBucket;
var deployment = new BucketDeployment(this, "Deployment", new BucketDeploymentProps {
Sources = new [] { Source.Asset("./website-dist") },
DestinationBucket = websiteBucket
});
deployment.AddSource(Source.Asset("./another-asset"));