@@ -14,10 +14,9 @@ export class StaticSiteStack extends cdk.Stack {
1414 constructor ( scope : cdk . Construct , id : string , props : StaticSiteStackProps ) {
1515 super ( scope , id , props ) ;
1616
17+ const certArn = "arn:aws:acm:us-east-1:725714232753:certificate/63474aa5-080f-4601-bb09-72e0d5eb2d29" ;
1718 const zone = route53 . HostedZone . fromLookup ( this , 'Zone' , { domainName : props . domainName } ) ;
1819 const siteDomain = `${ props . siteSubDomain } .${ props . domainName } ` ;
19- new cdk . CfnOutput ( this , "Site" , { value : "https://" + siteDomain } )
20-
2120 // The code that defines your stack goes here
2221 const siteBucket = new s3 . Bucket ( this , 'SiteBucket' , {
2322 bucketName : siteDomain ,
@@ -30,23 +29,12 @@ export class StaticSiteStack extends cdk.Stack {
3029 // DESTROY, cdk destroy will attempt to delete the bucket, but will error if the bucket is not empty.
3130 removalPolicy : cdk . RemovalPolicy . DESTROY , // NOT recommended for production code
3231 } ) ;
33- new cdk . CfnOutput ( this , "Bucket" , { value : siteBucket . bucketName } )
34-
3532
36- const certificateArn = new acm . DnsValidatedCertificate (
37- this ,
38- "SiteCertificate" ,
39- {
40- domainName : siteDomain ,
41- hostedZone : zone ,
42- region : "us-east-1" , // Cloudfront only checks this region for certificates.
43- }
44- ) . certificateArn
45- new cdk . CfnOutput ( this , "Certificate" , { value : certificateArn } )
33+
4634
4735 const distribution = new cloudfront . CloudFrontWebDistribution ( this , 'SiteDistribution' , {
4836 aliasConfiguration : {
49- acmCertRef : certificateArn ,
37+ acmCertRef : certArn ,
5038 names : [ siteDomain ] ,
5139 sslMethod : cloudfront . SSLMethod . SNI ,
5240 securityPolicy : cloudfront . SecurityPolicyProtocol . TLS_V1_1_2016 ,
@@ -63,9 +51,6 @@ export class StaticSiteStack extends cdk.Stack {
6351 }
6452 ]
6553 } ) ;
66- new cdk . CfnOutput ( this , "DistributionId" , {
67- value : distribution . distributionId ,
68- } )
6954 new route53 . ARecord ( this , 'SiteAliasRecord' , {
7055 recordName : siteDomain ,
7156 target : route53 . RecordTarget . fromAlias ( new targets . CloudFrontTarget ( distribution ) ) ,
0 commit comments