An AWS CDK module for quickly creating simple static site infrastructure
At the moment, this is simply a YAML file that will (given some existing infrastructure) create some infrastructure in your existing AWS account to host a static website. You could deploy a static site on this infrastructure.
One day, this module will be a full on AWS CDK Construct.
The YAML file creates
- an S3 bucket to host your site files
- a CloudFront distribution to serve the files from the S3 bucket
- using an existing ACM Certificate to provide HTTPS
- a Route 53 Record Set to point your domain to the CloudFront distribution
That's all there is to it!
You will need
- an AWS account
- a domain name
- to create a Public Hosted Zone for your domain name in Amazon Route 53
- to request a Public Certificate for your domain name in AWS Certificate Manager in the
us-east-1
region
Assuming you've set up the prerequisites, grab your
- Certificate ARN of the certificate you created in the
us-east-1
region from the ACM Console - Domain Name
- Hosted Zone ID for your domain name from the Route 53 Console
Then click one of these deploy links to deploy the stack in your chosen region:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- ap-south-1
- ap-northeast-1
- ap-northeast-2
- ap-northeast-3
- ap-southeast-1
- ap-southeast-2
- ca-central-1
- cn-north-1
- cn-northwest-1
- eu-central-1
- eu-west-1
- eu-west-2
- eu-west-3
- sa-east-1
- eu-north-1
- us-gov-west-1
Assuming you've installed and configured the AWS CLI, you can use the following commands to deploy your static site to the new infrstructure. Substitute:
<path-to-static-site-code>
with the path to the directory that contains your generated static site<domain-name>
to your domain name
aws s3 sync --acl public-read <path-to-static-site-code> s3://<domain-name>