TECHNOLOGY, TUTORIALS

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 Sticker

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[1]. 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,[2] I have simplified the process with a Github repo.

  1. Clone the repo
  2. Follow the instructions in the Readme file
  3. 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.

Footnotes


  1. AWS CDK Library of Constructs ↩︎

  2. 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. ↩︎

Harvey Ramer
Harvey Ramer
Harvey has been writing code for nearly twenty years. He builds web applications with React, Node.js, and MongoDB and deploys them to the cloud with CI/CD pipelines. He talks and writes about the Christian worldview, technology, startups, and how differences can become a collaborative asset.