-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SSL certificate for CloudFront distribution
This uses DNS validation and so when deploying one of the MusicCoop stacks, in order to see the details for the DNS CNAME record, you'll either need to use the verbose option (e.g. `cdk deploy -v MusicCoopDevelopmentStack`); or use the AWS web console to view the certificate in the AWS Certificate Manager. I've chosen to use the DNS validation method, becuase it means the SSL certificates will be automatically renewed as long as the relevant DNS CNAME record remains in place.
- Loading branch information
1 parent
f91db63
commit 4bfcb38
Showing
3 changed files
with
41 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,20 @@ | ||
import * as cdk from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
import * as acm from 'aws-cdk-lib/aws-certificatemanager'; | ||
|
||
interface CertificateStackProps extends cdk.StackProps { | ||
readonly domainName: string; | ||
} | ||
|
||
export class CertificateStack extends cdk.Stack { | ||
certificate: acm.Certificate; | ||
|
||
constructor(scope: Construct, id: string, props: CertificateStackProps) { | ||
super(scope, id, props); | ||
|
||
this.certificate = new acm.Certificate(this, 'certificate', { | ||
domainName: props.domainName, | ||
validation: acm.CertificateValidation.fromDns(), | ||
}); | ||
} | ||
} |
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