aws-cdk-static-site
v1.9.1
Published
Aws cdk static site construct
Downloads
28
Maintainers
Readme
Aws-cdk static site construct
An npm module exporting a configurable static site construct.
Installing
npm i aws-cdk-static-site
Basic Usage
import * as cdk from "@aws-cdk/core";
import StaticSite from "aws-cdk-static-site";
export default class StaticSiteStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props: cdk.StackProps) {
super(scope, id, props);
new StaticSite(this, id, {
domainName: "example.com",
siteAssetsPath: "./exampleSiteDirectory"
});
}
}
Specifying a subdomain
You can specify a subdomain using the siteSubDomain
property.
new StaticSite(this, id, {
siteSubDomain: "www",
domainName: "example.com",
siteAssetsPath: "./exampleSiteDirectory"
});
Specifying constructs
You can specify which constructs will be used with the constructConfig
property.
new StaticSite(this, id, {
domainName: "example.com",
siteAssetsPath: "./exampleSiteDirectory",
constructConfig: {
useRoute53: true,
useCloudfront: true,
useDeletableBucket: false
}
});
The construct config specified above is the default.
Links
- Static site construct inspired by the static-site example.
- CI/CD setup using this post.