@@ -89,6 +89,49 @@ Conditions:
8989 # re-using it doesn't seem possible?
9090 UseRoute53 : !And [!Equals [!Ref UseRoute53Nameservers, 'true'], !And [!Not [!Equals [!Ref CustomDomainName, '']], !Not [!Equals [!Ref CustomDomainNameAcmCertArn, '']]]]
9191
92+ Mappings :
93+ # this information comes from these locations, and will need to be kept manually up to date:
94+ # https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints
95+ # https://docs.aws.amazon.com/govcloud-us/latest/ug-west/using-govcloud-endpoints.html
96+ # http://docs.amazonaws.cn/en_us/general/latest/gr/rande.html#cnnorth_region
97+ RegionSpecificConfig :
98+ us-east-2 :
99+ s3Url : ' .s3-website.us-east-2.amazonaws.com'
100+ us-east-1 :
101+ s3Url : ' .s3-website-us-east-1.amazonaws.com'
102+ us-west-1 :
103+ s3Url : ' .s3-website-us-west-1.amazonaws.com'
104+ us-west-2 :
105+ s3Url : ' .s3-website-us-west-2.amazonaws.com'
106+ ap-south-1 :
107+ s3Url : ' .s3-website.ap-south-1.amazonaws.com'
108+ ap-northeast-3 :
109+ s3Url : ' .s3-website.ap-northeast-3.amazonaws.com'
110+ ap-northeast-2 :
111+ s3Url : ' .s3-website.ap-northeast-2.amazonaws.com'
112+ ap-southeast-1 :
113+ s3Url : ' .s3-website-ap-southeast-1.amazonaws.com'
114+ ap-southeast-2 :
115+ s3Url : ' .s3-website-ap-southeast-2.amazonaws.com'
116+ ap-northeast-1 :
117+ s3Url : ' .s3-website-ap-northeast-1.amazonaws.com'
118+ ca-central-1 :
119+ s3Url : ' .s3-website.ca-central-1.amazonaws.com'
120+ cn-northwest-1 :
121+ s3Url : ' .s3-website.cn-northwest-1.amazonaws.com.cn'
122+ eu-central-1 :
123+ s3Url : ' .s3-website.eu-central-1.amazonaws.com'
124+ eu-west-1 :
125+ s3Url : ' .s3-website-eu-west-1.amazonaws.com'
126+ eu-west-2 :
127+ s3Url : ' .s3-website.eu-west-2.amazonaws.com'
128+ eu-west-3 :
129+ s3Url : ' .s3-website.eu-west-3.amazonaws.com'
130+ sa-east-1 :
131+ s3Url : ' .s3-website-sa-east-1.amazonaws.com'
132+ us-gov-west-1 :
133+ s3Url : ' .s3-website-us-gov-west-1.amazonaws.com'
134+
92135Resources :
93136 ApiGatewayApi :
94137 Type : AWS::Serverless::Api
@@ -343,7 +386,10 @@ Resources:
343386 - RoutingRuleCondition :
344387 HttpErrorCodeReturnedEquals : 403
345388 RedirectRule :
346- HostName : !If [ UseCustomDomainName, !Ref CustomDomainName, !Join ['', [!Ref DevPortalSiteS3BucketName, '.s3-website-', !Ref 'AWS::Region', '.amazonaws.com']]]
389+ HostName : !If
390+ - UseCustomDomainName
391+ - !Ref CustomDomainName
392+ - !Join ['', [!Ref DevPortalSiteS3BucketName, !FindInMap ['RegionSpecificConfig', !Ref 'AWS::Region', 's3Url']]]
347393 ReplaceKeyPrefixWith : ' #!/'
348394
349395 ArtifactsS3Bucket :
@@ -892,7 +938,7 @@ Resources:
892938 DefaultRootObject : index.html
893939 Enabled : true
894940 Origins :
895- - DomainName : !Join ['', [!Ref DevPortalSiteS3BucketName, '.s3-website- ', !Ref 'AWS::Region', '.amazonaws.com' ]]
941+ - DomainName : !Join ['', [!Ref DevPortalSiteS3BucketName, !FindInMap ['RegionSpecificConfig ', !Ref 'AWS::Region', 's3Url'] ]]
896942 Id : ' dev-portal-site-s3-bucket'
897943 CustomOriginConfig :
898944 OriginProtocolPolicy : ' http-only'
@@ -936,9 +982,7 @@ Outputs:
936982 WebsiteURL :
937983 Value : !Join
938984 - ' '
939- - - http://
985+ - - ' http://'
940986 - !Ref DevPortalSiteS3BucketName
941- - .s3-website-
942- - !Ref ' AWS::Region'
943- - .amazonaws.com
987+ - !FindInMap ['RegionSpecificConfig', !Ref 'AWS::Region', 's3Url']
944988 Description : URL for website hosted on S3
0 commit comments