-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
38 lines (33 loc) · 1.01 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env node
import cdk = require("@aws-cdk/core");
import { StaticSite } from "./static-site";
/**
* This stack relies on getting the domain name from CDK context.
* Use 'cdk synth -c domain=mystaticsite.com -c subdomain=www'
* Or add the following to cdk.json:
* {
* "context": {
* "domain": "mystaticsite.com",
* "subdomain": "www"
* }
* }
**/
class MyStaticSiteStack extends cdk.Stack {
constructor(parent: cdk.App, name: string, props: cdk.StackProps) {
super(parent, name, props);
new StaticSite(this, "StaticSite", {
domainName: this.node.tryGetContext("domain"),
siteSubDomain: this.node.tryGetContext("subdomain"),
});
}
}
const app = new cdk.App();
new MyStaticSiteStack(app, "MyStaticSite-dev", {
env: {
// Stack must be in us-east-1, because the ACM certificate for a
// global CloudFront distribution must be requested in us-east-1.
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
},
});
app.synth();