How To Quickly Deploy an Angular Application with AWS CDK
At re:Invent 2019, I saw The AWS Cloud Development Kit (CDK) and learned how it removes the pain of deploying resources to the AWS cloud. I was curious. So I decided to experiment with the CDK using TypeScript. My goal was simple: to deploy a static site on AWS. But I wanted to make it a bit more interesting by including an Angular application. I bootstrapped a vanilla Angular install any developer could use and deploy.
Why Not Use Native CloudFormation?
CloudFormation is a powerful way to manage infrastructure as code. But it is not designed for human writers. Large teams use powerful enterprise tools to manage AWS infrastructure. But smaller teams sometimes do not have the expertise or resources to use those tools. For such teams, Amazon CDK brings a familiar feel to infrastructure as code.
In short, there is nothing wrong with CloudFormation. But maintaining CloudFormation templates is unwieldy for small development teams. CDK for the win!
A CDK Overview
At the heart of CDK is a library of Constructs. These structural building blocks represent cloud components. Constructs contain all the information needed to generate a valid CloudFormation template. Developers compose constructs to define higher level components, much like application code.
Trying It Out for Yourself
If you want test CDK for your own Angular projects, I have simplified the process with a Github repo.
- Clone the repo
- Follow the instructions in the Readme file
- Enjoy your static site hosted on S3 with CloudFront and Route53 DNS.
Using this project, you will have an Angular application hosted on S3 in an hour or two. The initial deployment takes about 30 minutes to provision AWS infrastructure.
Elad Ben-Israel from AWS offers a CDK Intro Workshop in TypeScript, Python, .NET, and Java. Use his workshop to learn more about how to use CDK to manage your AWS infrastructure as code. ↩︎