-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ETL-658] Bucket for hosting static HTML files for GX reports (#120)
* Create templates to create another s3 bucket where GX reports/artifacts can be hosted from
- Loading branch information
1 parent
1deebfc
commit 22391b0
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
template: | ||
type: file | ||
path: s3-bucket-html-hosting.yaml | ||
stack_name: recover-dev-shareable-artifacts-vpn-bucket | ||
parameters: | ||
BucketName: {{ stack_group_config.shareable_artifacts_vpn_bucket_name }} | ||
EnableVpnAccess: "true" | ||
stack_tags: | ||
{{ stack_group_config.default_stack_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
template: | ||
type: file | ||
path: s3-bucket-html-hosting.yaml | ||
stack_name: recover-shareable-artifacts-vpn-bucket | ||
parameters: | ||
BucketName: {{ stack_group_config.shareable_artifacts_vpn_bucket_name }} | ||
EnableVpnAccess: "true" | ||
stack_tags: | ||
{{ stack_group_config.default_stack_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
|
||
Description: >- | ||
This S3 bucket will be used for development and production, | ||
and for storing GX reports to be viewable from the Sage AWS VPN. | ||
Parameters: | ||
|
||
BucketName: | ||
Type: String | ||
Description: Name of the bucket. | ||
Default: '' | ||
|
||
EnableVpnAccess: | ||
Type: String | ||
Description: Whether to grant the Sage VPN read permissions on the bucket. | ||
AllowedValues: | ||
- "true" | ||
- "false" | ||
Default: "true" | ||
|
||
Conditions: | ||
HasBucketName: !Not [!Equals [!Ref BucketName, ""]] | ||
EnableVpnAccess: | ||
!Equals [!Ref EnableVpnAccess, "true"] | ||
|
||
Resources: | ||
Bucket: | ||
Type: AWS::S3::Bucket | ||
DeletionPolicy: Delete | ||
Properties: | ||
BucketName: !If [HasBucketName, !Ref BucketName, !Ref 'AWS::NoValue'] | ||
AccessControl: Private | ||
OwnershipControls: | ||
Rules: | ||
- ObjectOwnership: BucketOwnerEnforced | ||
BucketEncryption: | ||
ServerSideEncryptionConfiguration: | ||
- ServerSideEncryptionByDefault: | ||
SSEAlgorithm: AES256 | ||
PublicAccessBlockConfiguration: | ||
BlockPublicAcls : true | ||
BlockPublicPolicy : true | ||
IgnorePublicAcls : true | ||
RestrictPublicBuckets : true | ||
|
||
BucketPolicy: | ||
Type: AWS::S3::BucketPolicy | ||
Properties: | ||
Bucket: !Ref Bucket | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Sid: AccountRead | ||
Effect: Allow | ||
Principal: | ||
AWS: | ||
- !Sub '${AWS::AccountId}' | ||
Action: | ||
- 's3:Get*' | ||
- 's3:List*' | ||
Resource: | ||
- !Sub 'arn:aws:s3:::${Bucket}' | ||
- !Sub 'arn:aws:s3:::${Bucket}/*' | ||
- !If | ||
- EnableVpnAccess | ||
- Sid: Allow based on source IP | ||
Effect: Allow | ||
Principal: '*' | ||
Action: | ||
- 's3:GetObject' | ||
Resource: | ||
- !Sub 'arn:aws:s3:::${Bucket}' | ||
- !Sub 'arn:aws:s3:::${Bucket}/*' | ||
Condition: | ||
IpAddress: | ||
aws:SourceIp: '52.44.61.21' | ||
- !Ref AWS::NoValue | ||
|
||
Outputs: | ||
|
||
BucketName: | ||
Value: !Ref Bucket | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-BucketName' | ||
|
||
BucketArn: | ||
Value: !GetAtt Bucket.Arn | ||
Export: | ||
Name: !Sub '${AWS::Region}-${AWS::StackName}-BucketArn' |