ServerSideEncryption Enum
Indicates whether server-side encryption is enabled for the object, and whether that encryption is from the AWS Key Management Service (AWS KMS) or from Amazon S3 managed encryption (SSE-S3).
| Source | aws-s3-deployment/lib/bucket-deployment.ts |
|---|---|
| Type last changed |
Example
ts
const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', {
websiteIndexDocument: 'index.html',
publicReadAccess: true,
});
new s3deploy.BucketDeployment(this, 'DeployWebsite', {
sources: [s3deploy.Source.asset('./website-dist')],
destinationBucket: websiteBucket,
destinationKeyPrefix: 'web/static', // optional prefix in destination bucket
metadata: { A: "1", b: "2" }, // user-defined metadata
// system-defined metadata
contentType: "text/html",
contentLanguage: "en",
storageClass: s3deploy.StorageClass.INTELLIGENT_TIERING,
serverSideEncryption: s3deploy.ServerSideEncryption.AES_256,
cacheControl: [
s3deploy.CacheControl.setPublic(),
s3deploy.CacheControl.maxAge(Duration.hours(1)),
],
accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL,
});
python
website_bucket = s3.Bucket(self, "WebsiteBucket",
website_index_document="index.html",
public_read_access=True
)
s3deploy.BucketDeployment(self, "DeployWebsite",
sources=[s3deploy.Source.asset("./website-dist")],
destination_bucket=website_bucket,
destination_key_prefix="web/static", # optional prefix in destination bucket
metadata={"A": "1", "b": "2"}, # user-defined metadata
# system-defined metadata
content_type="text/html",
content_language="en",
storage_class=s3deploy.StorageClass.INTELLIGENT_TIERING,
server_side_encryption=s3deploy.ServerSideEncryption.AES_256,
cache_control=[
s3deploy.CacheControl.set_public(),
s3deploy.CacheControl.max_age(Duration.hours(1))
],
access_control=s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL
)
java
Bucket websiteBucket = Bucket.Builder.create(this, "WebsiteBucket")
.websiteIndexDocument("index.html")
.publicReadAccess(true)
.build();
BucketDeployment.Builder.create(this, "DeployWebsite")
.sources(List.of(Source.asset("./website-dist")))
.destinationBucket(websiteBucket)
.destinationKeyPrefix("web/static") // optional prefix in destination bucket
.metadata(Map.of("A", "1", "b", "2")) // user-defined metadata
// system-defined metadata
.contentType("text/html")
.contentLanguage("en")
.storageClass(StorageClass.INTELLIGENT_TIERING)
.serverSideEncryption(ServerSideEncryption.AES_256)
.cacheControl(List.of(CacheControl.setPublic(), CacheControl.maxAge(Duration.hours(1))))
.accessControl(BucketAccessControl.BUCKET_OWNER_FULL_CONTROL)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var websiteBucket = new Bucket(this, "WebsiteBucket", new BucketProps {
WebsiteIndexDocument = "index.html",
PublicReadAccess = true
});
new BucketDeployment(this, "DeployWebsite", new BucketDeploymentProps {
Sources = new [] { Source.Asset("./website-dist") },
DestinationBucket = websiteBucket,
DestinationKeyPrefix = "web/static", // optional prefix in destination bucket
Metadata = new Dictionary<string, string> { { "A", "1" }, { "b", "2" } }, // user-defined metadata
// system-defined metadata
ContentType = "text/html",
ContentLanguage = "en",
StorageClass = StorageClass.INTELLIGENT_TIERING,
ServerSideEncryption = ServerSideEncryption.AES_256,
CacheControl = new [] { CacheControl.SetPublic(), CacheControl.MaxAge(Duration.Hours(1)) },
AccessControl = BucketAccessControl.BUCKET_OWNER_FULL_CONTROL
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
websiteBucket := s3.NewBucket(this, jsii.String("WebsiteBucket"), &BucketProps{
WebsiteIndexDocument: jsii.String("index.html"),
PublicReadAccess: jsii.Boolean(true),
})
s3deploy.NewBucketDeployment(this, jsii.String("DeployWebsite"), &BucketDeploymentProps{
Sources: []ISource{
s3deploy.Source_Asset(jsii.String("./website-dist")),
},
DestinationBucket: websiteBucket,
DestinationKeyPrefix: jsii.String("web/static"),
// optional prefix in destination bucket
Metadata: map[string]*string{
"A": jsii.String("1"),
"b": jsii.String("2"),
},
// user-defined metadata
// system-defined metadata
ContentType: jsii.String("text/html"),
ContentLanguage: jsii.String("en"),
StorageClass: s3deploy.StorageClass_INTELLIGENT_TIERING,
ServerSideEncryption: s3deploy.ServerSideEncryption_AES_256,
CacheControl: []CacheControl{
s3deploy.CacheControl_SetPublic(),
s3deploy.CacheControl_MaxAge(awscdk.Duration_Hours(jsii.Number(1))),
},
AccessControl: s3.BucketAccessControl_BUCKET_OWNER_FULL_CONTROL,
})
Members
| Member | Description |
|---|---|
AES_256 | 'AES256'. |
AWS_KMS | 'aws:kms'. |
AWS_KMS_DSSE | 'aws:kms:dsse'. |
Referenced by
BucketDeploymentProps.serverSideEncryptionserver_side_encryptionserverSideEncryptionServerSideEncryptionServerSideEncryptionProductStackProps.serverSideEncryptionserver_side_encryptionserverSideEncryptionServerSideEncryptionServerSideEncryption