Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

chore: add encryption, https-only, access logging to all buckets #253

Merged
merged 3 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions cloudformation/bulkExport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,33 @@ Resources:

GlueScriptsBucket:
Type: AWS::S3::Bucket
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
rsmayda marked this conversation as resolved.
Show resolved Hide resolved
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
LoggingConfiguration:
DestinationBucketName: !Ref FHIRLogsBucket
LogFilePrefix: 'GlueScriptsBucket'

GlueScriptsBucketHttpsOnlyPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref GlueScriptsBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AllowSSLRequestsOnly
Effect: Deny
Principal: '*'
Action:
- s3:*
Resource:
- !GetAtt GlueScriptsBucket.Arn
- !Join ['', [!GetAtt GlueScriptsBucket.Arn, '/*']]
Condition:
Bool:
'aws:SecureTransport': false

BulkExportResultsBucket:
Type: AWS::S3::Bucket
Expand All @@ -51,6 +78,32 @@ Resources:
- Id: ExpirationRule
Status: Enabled
ExpirationInDays: '3'
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
LoggingConfiguration:
DestinationBucketName: !Ref FHIRLogsBucket
LogFilePrefix: 'BulkExportResultsBucket'

BulkExportResultsBucketHttpsOnlyPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref BulkExportResultsBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AllowSSLRequestsOnly
Effect: Deny
Principal: '*'
Action:
- s3:*
Resource:
- !GetAtt BulkExportResultsBucket.Arn
- !Join ['', [!GetAtt BulkExportResultsBucket.Arn, '/*']]
Condition:
Bool:
'aws:SecureTransport': false

GlueJobRole:
Type: AWS::IAM::Role
Expand Down
22 changes: 22 additions & 0 deletions serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ resources:
UpdateReplacePolicy: Retain
Properties:
AccessControl: LogDeliveryWrite
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
FHIRBinaryBucketHttpsOnlyPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Expand All @@ -329,6 +333,24 @@ resources:
Condition:
Bool:
'aws:SecureTransport': false
FHIRLogsBucketHttpsOnlyPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref FHIRLogsBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AllowSSLRequestsOnly
Effect: Deny
Principal: '*'
Action:
- s3:*
Resource:
- !GetAtt FHIRLogsBucket.Arn
- !Join ['', [!GetAtt FHIRLogsBucket.Arn, '/*']]
Condition:
Bool:
'aws:SecureTransport': false
FhirServerLambdaRole:
Type: AWS::IAM::Role
Properties:
Expand Down