Show / Hide Table of Contents

Class BucketDeploymentProps

Properties for BucketDeployment.

Inheritance
System.Object
BucketDeploymentProps
Implements
IBucketDeploymentProps
Namespace: Amazon.CDK.AWS.S3.Deployment
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BucketDeploymentProps : Object, IBucketDeploymentProps
Syntax (vb)
Public Class BucketDeploymentProps
    Inherits Object
    Implements IBucketDeploymentProps
Remarks

ExampleMetadata: infused

Examples
Bucket destinationBucket;


var deployment = new BucketDeployment(this, "DeployFiles", new BucketDeploymentProps {
    Sources = new [] { Source.Asset(Join(__dirname, "source-files")) },
    DestinationBucket = destinationBucket
});

deployment.HandlerRole.AddToPolicy(
new PolicyStatement(new PolicyStatementProps {
    Actions = new [] { "kms:Decrypt", "kms:DescribeKey" },
    Effect = Effect.ALLOW,
    Resources = new [] { "<encryption key ARN>" }
}));

Synopsis

Constructors

BucketDeploymentProps()

Properties

AccessControl

System-defined x-amz-acl metadata to be set on all objects in the deployment.

CacheControl

System-defined cache-control metadata to be set on all objects in the deployment.

ContentDisposition

System-defined cache-disposition metadata to be set on all objects in the deployment.

ContentEncoding

System-defined content-encoding metadata to be set on all objects in the deployment.

ContentLanguage

System-defined content-language metadata to be set on all objects in the deployment.

ContentType

System-defined content-type metadata to be set on all objects in the deployment.

DestinationBucket

The S3 bucket to sync the contents of the zip file to.

DestinationKeyPrefix

Key prefix in the destination bucket. Must be <=104 characters.

Distribution

The CloudFront distribution using the destination bucket as an origin.

DistributionPaths

The file paths to invalidate in the CloudFront distribution.

EphemeralStorageSize

The size of the AWS Lambda function’s /tmp directory in MiB.

Exclude

If this is set, matching files or objects will be excluded from the deployment's sync command.

Expires

System-defined expires metadata to be set on all objects in the deployment.

Extract

If this is set, the zip file will be synced to the destination S3 bucket and extracted.

Include

If this is set, matching files or objects will be included with the deployment's sync command.

LogGroup

The Log Group used for logging of events emitted by the custom resource's lambda function.

LogRetention

The number of days that the lambda function's log events are kept in CloudWatch Logs.

MemoryLimit

The amount of memory (in MiB) to allocate to the AWS Lambda function which replicates the files from the CDK bucket to the destination bucket.

Metadata

User-defined object metadata to be set on all objects in the deployment.

OutputObjectKeys

If set to false, the custom resource will not send back the SourceObjectKeys.

Prune

By default, files in the destination bucket that don't exist in the source will be deleted when the BucketDeployment resource is created or updated.

RetainOnDelete

If this is set to "false", the destination files will be deleted when the resource is deleted or the destination is updated.

Role

Execution role associated with this function.

ServerSideEncryption

System-defined x-amz-server-side-encryption metadata to be set on all objects in the deployment.

ServerSideEncryptionAwsKmsKeyId

System-defined x-amz-server-side-encryption-aws-kms-key-id metadata to be set on all objects in the deployment.

ServerSideEncryptionCustomerAlgorithm

System-defined x-amz-server-side-encryption-customer-algorithm metadata to be set on all objects in the deployment.

SignContent

If set to true, uploads will precompute the value of x-amz-content-sha256 and include it in the signed S3 request headers.

Sources

The sources from which to deploy the contents of this bucket.

StorageClass

System-defined x-amz-storage-class metadata to be set on all objects in the deployment.

UseEfs

Mount an EFS file system.

Vpc

The VPC network to place the deployment lambda handler in.

VpcSubnets

Where in the VPC to place the deployment lambda handler.

WebsiteRedirectLocation

System-defined x-amz-website-redirect-location metadata to be set on all objects in the deployment.

Constructors

BucketDeploymentProps()

public BucketDeploymentProps()

Properties

AccessControl

System-defined x-amz-acl metadata to be set on all objects in the deployment.

public Nullable<BucketAccessControl> AccessControl { get; set; }
Property Value

System.Nullable<BucketAccessControl>

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl

CacheControl

System-defined cache-control metadata to be set on all objects in the deployment.

public CacheControl[] CacheControl { get; set; }
Property Value

CacheControl[]

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ContentDisposition

System-defined cache-disposition metadata to be set on all objects in the deployment.

public string ContentDisposition { get; set; }
Property Value

System.String

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ContentEncoding

System-defined content-encoding metadata to be set on all objects in the deployment.

public string ContentEncoding { get; set; }
Property Value

System.String

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ContentLanguage

System-defined content-language metadata to be set on all objects in the deployment.

public string ContentLanguage { get; set; }
Property Value

System.String

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ContentType

System-defined content-type metadata to be set on all objects in the deployment.

public string ContentType { get; set; }
Property Value

System.String

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

DestinationBucket

The S3 bucket to sync the contents of the zip file to.

public IBucket DestinationBucket { get; set; }
Property Value

IBucket

DestinationKeyPrefix

Key prefix in the destination bucket. Must be <=104 characters.

public string DestinationKeyPrefix { get; set; }
Property Value

System.String

Remarks

If it's set with prune: true, it will only prune files with the prefix.

We recommend to always configure the destinationKeyPrefix property. This will prevent the deployment from accidentally deleting data that wasn't uploaded by it.

Default: "/" (unzip to root of the destination bucket)

Distribution

The CloudFront distribution using the destination bucket as an origin.

public IDistribution Distribution { get; set; }
Property Value

IDistribution

Remarks

Files in the distribution's edge caches will be invalidated after files are uploaded to the destination bucket.

Default: - No invalidation occurs

DistributionPaths

The file paths to invalidate in the CloudFront distribution.

public string[] DistributionPaths { get; set; }
Property Value

System.String[]

Remarks

Default: - All files under the destination bucket key prefix will be invalidated.

EphemeralStorageSize

The size of the AWS Lambda function’s /tmp directory in MiB.

public Size EphemeralStorageSize { get; set; }
Property Value

Size

Remarks

Default: 512 MiB

Exclude

If this is set, matching files or objects will be excluded from the deployment's sync command.

public string[] Exclude { get; set; }
Property Value

System.String[]

Remarks

This can be used to exclude a file from being pruned in the destination bucket.

If you want to just exclude files from the deployment package (which excludes these files evaluated when invalidating the asset), you should leverage the exclude property of AssetOptions when defining your source.

Default: - No exclude filters are used

See: https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters

Expires

System-defined expires metadata to be set on all objects in the deployment.

public Expiration Expires { get; set; }
Property Value

Expiration

Remarks

Default: - The objects in the distribution will not expire.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

Extract

If this is set, the zip file will be synced to the destination S3 bucket and extracted.

public Nullable<bool> Extract { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

If false, the file will remain zipped in the destination bucket.

Default: true

Include

If this is set, matching files or objects will be included with the deployment's sync command.

public string[] Include { get; set; }
Property Value

System.String[]

Remarks

Since all files from the deployment package are included by default, this property is usually leveraged alongside an exclude filter.

Default: - No include filters are used and all files are included with the sync command

See: https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters

LogGroup

The Log Group used for logging of events emitted by the custom resource's lambda function.

public ILogGroup LogGroup { get; set; }
Property Value

ILogGroup

Remarks

Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.

Default: - a default log group created by AWS Lambda

LogRetention

The number of days that the lambda function's log events are kept in CloudWatch Logs.

public Nullable<RetentionDays> LogRetention { get; set; }
Property Value

System.Nullable<RetentionDays>

Remarks

This is a legacy API and we strongly recommend you migrate to logGroup if you can. logGroup allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.

Default: logs.RetentionDays.INFINITE

MemoryLimit

The amount of memory (in MiB) to allocate to the AWS Lambda function which replicates the files from the CDK bucket to the destination bucket.

public Nullable<double> MemoryLimit { get; set; }
Property Value

System.Nullable<System.Double>

Remarks

If you are deploying large files, you will need to increase this number accordingly.

Default: 128

Metadata

User-defined object metadata to be set on all objects in the deployment.

public IDictionary<string, string> Metadata { get; set; }
Property Value

System.Collections.Generic.IDictionary<System.String, System.String>

Remarks

Default: - No user metadata is set

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#UserMetadata

OutputObjectKeys

If set to false, the custom resource will not send back the SourceObjectKeys.

public Nullable<bool> OutputObjectKeys { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

This is useful when you are facing the error Response object is too long

See https://github.com/aws/aws-cdk/issues/28579

Default: true

Prune

By default, files in the destination bucket that don't exist in the source will be deleted when the BucketDeployment resource is created or updated.

public Nullable<bool> Prune { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

If this is set to false, files in the destination bucket that do not exist in the asset, will NOT be deleted during deployment (create/update).

Default: true

See: https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

RetainOnDelete

If this is set to "false", the destination files will be deleted when the resource is deleted or the destination is updated.

public Nullable<bool> RetainOnDelete { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

NOTICE: Configuring this to "false" might have operational implications. Please visit to the package documentation referred below to make sure you fully understand those implications.

Default: true - when resource is deleted/updated, files are retained

See: https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-lib/aws-s3-deployment#retain-on-delete

Role

Execution role associated with this function.

public IRole Role { get; set; }
Property Value

IRole

Remarks

Default: - A role is automatically created

ServerSideEncryption

System-defined x-amz-server-side-encryption metadata to be set on all objects in the deployment.

public Nullable<ServerSideEncryption> ServerSideEncryption { get; set; }
Property Value

System.Nullable<ServerSideEncryption>

Remarks

Default: - Server side encryption is not used.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ServerSideEncryptionAwsKmsKeyId

System-defined x-amz-server-side-encryption-aws-kms-key-id metadata to be set on all objects in the deployment.

public string ServerSideEncryptionAwsKmsKeyId { get; set; }
Property Value

System.String

Remarks

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

ServerSideEncryptionCustomerAlgorithm

System-defined x-amz-server-side-encryption-customer-algorithm metadata to be set on all objects in the deployment.

public string ServerSideEncryptionCustomerAlgorithm { get; set; }
Property Value

System.String

Remarks

Warning: This is not a useful parameter until this bug is fixed: https://github.com/aws/aws-cdk/issues/6080

Default: - Not set.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html#sse-c-how-to-programmatically-intro

SignContent

If set to true, uploads will precompute the value of x-amz-content-sha256 and include it in the signed S3 request headers.

public Nullable<bool> SignContent { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

Default: - x-amz-content-sha256 will not be computed

Sources

The sources from which to deploy the contents of this bucket.

public ISource[] Sources { get; set; }
Property Value

ISource[]

StorageClass

System-defined x-amz-storage-class metadata to be set on all objects in the deployment.

public Nullable<StorageClass> StorageClass { get; set; }
Property Value

System.Nullable<StorageClass>

Remarks

Default: - Default storage-class for the bucket is used.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

UseEfs

Mount an EFS file system.

public Nullable<bool> UseEfs { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

Enable this if your assets are large and you encounter disk space errors. Enabling this option will require a VPC to be specified.

Default: - No EFS. Lambda has access only to 512MB of disk space.

Vpc

The VPC network to place the deployment lambda handler in.

public IVpc Vpc { get; set; }
Property Value

IVpc

Remarks

This is required if useEfs is set.

Default: None

VpcSubnets

Where in the VPC to place the deployment lambda handler.

public ISubnetSelection VpcSubnets { get; set; }
Property Value

ISubnetSelection

Remarks

Only used if 'vpc' is supplied.

Default: - the Vpc default strategy if not specified

WebsiteRedirectLocation

System-defined x-amz-website-redirect-location metadata to be set on all objects in the deployment.

public string WebsiteRedirectLocation { get; set; }
Property Value

System.String

Remarks

Default: - No website redirection.

See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata

Implements

IBucketDeploymentProps
Back to top Generated by DocFX