@@ -206,6 +206,14 @@ export interface BucketImportProps {
206
206
* @default Inferred from bucket name
207
207
*/
208
208
bucketWebsiteUrl ?: string ;
209
+
210
+ /**
211
+ * The format of the website URL of the bucket. This should be true for
212
+ * regions launched since 2014.
213
+ *
214
+ * @default false
215
+ */
216
+ bucketWebsiteNewUrlFormat ?: boolean ;
209
217
}
210
218
211
219
/**
@@ -967,6 +975,7 @@ class ImportedBucket extends BucketBase {
967
975
public readonly bucketName : string ;
968
976
public readonly domainName : string ;
969
977
public readonly bucketWebsiteUrl : string ;
978
+ public readonly bucketWebsiteNewUrlFormat : boolean ;
970
979
public readonly encryptionKey ?: kms . EncryptionKey ;
971
980
972
981
public policy ?: BucketPolicy ;
@@ -985,6 +994,9 @@ class ImportedBucket extends BucketBase {
985
994
this . domainName = props . bucketDomainName || this . generateDomainName ( ) ;
986
995
this . bucketWebsiteUrl = props . bucketWebsiteUrl || this . generateBucketWebsiteUrl ( ) ;
987
996
this . autoCreatePolicy = false ;
997
+ this . bucketWebsiteNewUrlFormat = props . bucketWebsiteNewUrlFormat === undefined
998
+ ? false
999
+ : props . bucketWebsiteNewUrlFormat ;
988
1000
this . policy = undefined ;
989
1001
}
990
1002
@@ -1000,6 +1012,8 @@ class ImportedBucket extends BucketBase {
1000
1012
}
1001
1013
1002
1014
private generateBucketWebsiteUrl ( ) {
1003
- return `${ this . bucketName } .s3-website-${ new cdk . Aws ( ) . region } .amazonaws.com` ;
1015
+ return this . bucketWebsiteNewUrlFormat
1016
+ ? `${ this . bucketName } .s3-website.${ cdk . Stack . find ( this ) . region } .${ cdk . Stack . find ( this ) . urlSuffix } `
1017
+ : `${ this . bucketName } .s3-website-${ cdk . Stack . find ( this ) . region } .${ cdk . Stack . find ( this ) . urlSuffix } ` ;
1004
1018
}
1005
1019
}
0 commit comments