Class BucketDeploymentProps
Properties for BucketDeployment
.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.S3.Deployment
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BucketDeploymentProps : IBucketDeploymentProps
Syntax (vb)
Public Class BucketDeploymentProps 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 for |
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 |
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()
Properties for BucketDeployment
.
public BucketDeploymentProps()
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>" }
}));
Properties
AccessControl
System-defined x-amz-acl metadata to be set on all objects in the deployment.
public BucketAccessControl? AccessControl { get; set; }
Property Value
Remarks
CacheControl
System-defined cache-control metadata to be set on all objects in the deployment.
public CacheControl[]? CacheControl { get; set; }
Property Value
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
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
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
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
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
Remarks
ExampleMetadata: infused
DestinationKeyPrefix
Key prefix in the destination bucket. Must be <=104 characters.
public string? DestinationKeyPrefix { get; set; }
Property Value
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
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
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
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
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
Expires
System-defined expires metadata to be set on all objects in the deployment.
public Expiration? Expires { get; set; }
Property Value
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 bool? Extract { get; set; }
Property Value
bool?
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
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
LogGroup
The Log Group used for logging of events emitted by the custom resource's lambda function.
public ILogGroup? LogGroup { get; set; }
Property Value
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 RetentionDays? LogRetention { get; set; }
Property Value
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 double? MemoryLimit { get; set; }
Property Value
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
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 bool? OutputObjectKeys { get; set; }
Property Value
bool?
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 bool? Prune { get; set; }
Property Value
bool?
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 bool? RetainOnDelete { get; set; }
Property Value
bool?
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
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 ServerSideEncryption? ServerSideEncryption { get; set; }
Property Value
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
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
Remarks
Warning: This is not a useful parameter until this bug is fixed: https://github.com/aws/aws-cdk/issues/6080
Default: - Not set.
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 bool? SignContent { get; set; }
Property Value
bool?
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[]
Remarks
ExampleMetadata: infused
StorageClass
System-defined x-amz-storage-class metadata to be set on all objects in the deployment.
public StorageClass? StorageClass { get; set; }
Property Value
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 bool? UseEfs { get; set; }
Property Value
bool?
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
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
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
Remarks
Default: - No website redirection.
See: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata