Skip to content

Commit

Permalink
Use the derived WebsiteURL
Browse files Browse the repository at this point in the history
A given region, will not have a predictable website url, see:
https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints

This is annoying. Further, it is annoying that an Origin can not have
'http://' in it so we can not use the AWS::S3::Bucket WebsiteURL
attribute. Ergo, this complicated Fn::Split, Fn::Select thing.
  • Loading branch information
jolexa committed Jul 25, 2017
1 parent cb1bd2e commit 6526541
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion primary-region-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ Resources:
Enabled: 'true'
HttpVersion: http2
Origins:
- DomainName: !Sub "${PrimaryBucket}.s3-website-${AWS::Region}.amazonaws.com"
# Use the WebsiteURL /but/ use the part after '//'
- DomainName: !Select [ "1" , "Fn::Split": [ "//", "Fn::GetAtt": [ PrimaryBucket, WebsiteURL ] ] ]
Id: PrimaryBucketOrigin
CustomOriginConfig:
OriginProtocolPolicy: "http-only"
Expand Down
3 changes: 2 additions & 1 deletion standby-region-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ Resources:
Enabled: true
HttpVersion: http2
Origins:
- DomainName: !Sub "${StandbyReplicationBucket}.s3-website-${AWS::Region}.amazonaws.com"
# Use the WebsiteURL /but/ use the part after '//'
- DomainName: !Select [ "1" , "Fn::Split": [ "//", "Fn::GetAtt": [ StandbyReplicationBucket, WebsiteURL ] ] ]
Id: StandbyBucketOrigin
CustomOriginConfig:
OriginProtocolPolicy: "http-only"
Expand Down

0 comments on commit 6526541

Please sign in to comment.