From aec0f036b41bd7b3f13320d5e284064ddc5385c4 Mon Sep 17 00:00:00 2001 From: Mohamed Elasmar <71043312+moelasmar@users.noreply.github.com> Date: Thu, 17 Aug 2023 13:34:42 -0700 Subject: [PATCH] fix: enable encryption and versioning for S3 buckets defined in app templates (#447) --- dotnet6/s3/{{cookiecutter.project_name}}/template.yaml | 5 +++++ nodejs14.x/s3/{{cookiecutter.project_name}}/template.yaml | 5 +++++ nodejs16.x/s3/{{cookiecutter.project_name}}/template.yaml | 5 +++++ .../full-stack/{{cookiecutter.project_name}}/template.yaml | 6 ++++++ nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml | 5 +++++ 5 files changed, 26 insertions(+) diff --git a/dotnet6/s3/{{cookiecutter.project_name}}/template.yaml b/dotnet6/s3/{{cookiecutter.project_name}}/template.yaml index 5165fe09b..2383379e3 100644 --- a/dotnet6/s3/{{cookiecutter.project_name}}/template.yaml +++ b/dotnet6/s3/{{cookiecutter.project_name}}/template.yaml @@ -41,6 +41,11 @@ Resources: Type: AWS::S3::Bucket Properties: BucketName: !Ref AppBucketName + BucketEncryption: + ServerSideEncryptionConfiguration: + - BucketKeyEnabled: true + VersioningConfiguration: + Status: Enabled Outputs: AppBucketArn: diff --git a/nodejs14.x/s3/{{cookiecutter.project_name}}/template.yaml b/nodejs14.x/s3/{{cookiecutter.project_name}}/template.yaml index e3b5f0011..eada3e39c 100644 --- a/nodejs14.x/s3/{{cookiecutter.project_name}}/template.yaml +++ b/nodejs14.x/s3/{{cookiecutter.project_name}}/template.yaml @@ -40,3 +40,8 @@ Resources: Type: AWS::S3::Bucket Properties: BucketName: !Ref AppBucketName + BucketEncryption: + ServerSideEncryptionConfiguration: + - BucketKeyEnabled: true + VersioningConfiguration: + Status: Enabled diff --git a/nodejs16.x/s3/{{cookiecutter.project_name}}/template.yaml b/nodejs16.x/s3/{{cookiecutter.project_name}}/template.yaml index 54ed392b0..121c37b09 100644 --- a/nodejs16.x/s3/{{cookiecutter.project_name}}/template.yaml +++ b/nodejs16.x/s3/{{cookiecutter.project_name}}/template.yaml @@ -40,3 +40,8 @@ Resources: Type: AWS::S3::Bucket Properties: BucketName: !Ref AppBucketName + BucketEncryption: + ServerSideEncryptionConfiguration: + - BucketKeyEnabled: true + VersioningConfiguration: + Status: Enabled diff --git a/nodejs18.x/full-stack/{{cookiecutter.project_name}}/template.yaml b/nodejs18.x/full-stack/{{cookiecutter.project_name}}/template.yaml index 8def4e21d..0833941ef 100644 --- a/nodejs18.x/full-stack/{{cookiecutter.project_name}}/template.yaml +++ b/nodejs18.x/full-stack/{{cookiecutter.project_name}}/template.yaml @@ -151,6 +151,12 @@ Resources: # S3 Bucket to host single page app website WebSiteBucket: Type: "AWS::S3::Bucket" + Properties: + BucketEncryption: + ServerSideEncryptionConfiguration: + - BucketKeyEnabled: true + VersioningConfiguration: + Status: Enabled WebSiteBucketPolicy: Type: "AWS::S3::BucketPolicy" Properties: diff --git a/nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml b/nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml index e222bd36e..8cb194af1 100644 --- a/nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml +++ b/nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml @@ -40,3 +40,8 @@ Resources: Type: AWS::S3::Bucket Properties: BucketName: !Ref AppBucketName + BucketEncryption: + ServerSideEncryptionConfiguration: + - BucketKeyEnabled: true + VersioningConfiguration: + Status: Enabled