There are several points to this series of demonstrations:
Demonstration of borrowing an AWS CDK app stack template so we don’t have to start from scratch. The example will be used in a separate video to create a static website.
Demonstration of deploying a static website hosted in Amazon S3 fronted by Amazon CloudFront. The demonstration uses the AWS CDK template borrowed in the prior video.
Demonstration explaining some of the AWS CDK components for deploying a static website hosted in Amazon S3 fronted by Amazon CloudFront. Includes a brief note on the relationship of the CDK App, Stack, and Construct. The demonstration uses the AWS CDK template borrowed and deployed earlier.
Here are the purpose points for the static site demo deck.
Steps:
git clone https://github.com/bwer432/awsdemo
cd awsdemo/static-site-demo
git clone https://github.com/aws-samples/aws-cdk-examples
cp -R aws-cdk-examples/typescript/static-site ./static-site
rm -rf aws-cdk-examples
cd static-site
ls
git clone https://github.com/bwer432/awsdemo
cd awsdemo/static-site-demo/static-site
npm install
npm run build
accountId=$(aws sts get-caller-identity --query Account --output text)
aws route53 list-hosted-zones --query "HostedZones[].Name"
zone=$(aws route53 list-hosted-zones --query "HostedZones[0].Name" --output text | sed 's@\.$@@')
npx cdk deploy -c accountId=$accountId -c domain=$zone -c subdomain=www
Delete the stack when you are done.
accountId and zone variables if in a new shell session.cdk destroy with the same context values as you used on the deploy.npx cdk destroy -c accountId=$accountId -c domain=$zone -c subdomain=www -f