Implemented with TypeScript, HTTPS, a CDN, CI/CD with Buddy and your own domain name.

Image for post
Image for post

What we will be building:

Our React application will be:

  • Hosted on AWS S3
  • Distributed around the world with AWS CloudFront’s CDN,
  • Have a domain name through AWS Route 53
  • Have HTTPS enabled through certificates provided by AWS Certificate Manager
  • Built fully with Infrastructure as code through the use of AWS CDK where we will build the infrastructure with TypeScript
  • Deployed continuously with Buddy. Both the React client app and Infrastructure will have their own CI/CD pipelines

Here is a deployment of the app we will be building: https://andrew-bestbier-cdk-blog.com


Go from creating a simple Node app to having it containerized, load-balanced, and deployed

Image for post
Image for post
Photo by Pixabay from Pexels

In this post, I will guide you through the process of deploying a Node app on AWS ECS with Terraform.

Guide Overview

We will follow these steps:

  1. Create a simple Node app and run it locally.
  2. Dockerize the Node app.
  3. Create an image repository on AWS ECR and push the image.
  4. Create an AWS ECS cluster.
  5. Create an AWS ECS task.
  6. Create an AWS ECS service.
  7. Create a load balancer.

The technologies used in this guide are:

Prerequisites


Using AWS VPC, subnets, auto-scaling, load balancing, PostgreSQL, and EC2

Today, I am going to show you how to build a highly available, secure and fault-tolerant application on AWS. We will be building this application together from first principles:

Image for post
Image for post

The components are as follows: (Don’t worry if you are not familiar with these terms, we will be going through this step-by-step):

  • A VPC.
  • Four subnets (two private and two public).
  • An application load balancer.
  • EC2 instances.
  • An auto-scaling group that scales the instances horizontally.
  • A PostgreSQL database replicated across to a different availability zone.

Infrastructure As Code

Infrastructure as code is a methodology of managing one’s infrastructure using configuration specifications.

In essence, rather than building one’s infrastructure with AWS’s UI, you can write a specification that defines the infrastructure you require. This specification is then provided to AWS CloudFormation which then spins up the underlying services for you. …


Let’s try serverless

Image for post
Image for post

Introduction

A few weeks ago, I wrote a piece detailing how you can build a serverless API entirely through the AWS console UI:

In practise, you’d never actually build a production application this way, but it’s an excellent learning experience to do so.

Using infrastructure as code (IaC) is the proper way to build production serverless applications, and this piece will show you how to build the same application but much more elegantly and quickly with the AWS Serverless Application Model (AWS SAM).

Prerequisites

To follow this guide properly, you’ll need to go through the installation steps described in AWS’s own guide.

This involves signing up for an AWS account, installing the AWS CLI, installing the AWS SAM CLI, and creating an S3 bucket for your SAM applications. Note that you’ll need to use your bucket name throughout this guide, so remember it! …


AWS, Buddy, TravisCI, CircleCI, and GitLab

Image for post
Image for post

Last week, I wrote five different articles about CI/CD services. In each article, I took this Node application and deployed it to AWS with a different CI/CD service. See the individual posts below:

Method

The steps followed for each CI/CD pipeline can be seen below. Notice how Docker Hub is used to store the built Docker images and Elastic Beanstalk is used to pull and run those images:

Image for post
Image for post

Results

The results can be seen in the table below. I encourage you to follow the guides to replicate these results yourself. A few notes:

  • The configuration time is subjective as it depends on your familiarity with each tool. For transparency, I have previously set up pipelines with Buddy as you can see in my other blog posts on Medium. That said, the ability to configure pipelines visually drastically decreases the configuration time. …


A guide to continuously integrating and deploying your Dockerised Node app to AWS Elastic Beanstalk with Travis

Image for post
Image for post

Introduction

This piece has two goals:

  • To be a standalone guide to building a CI/CD pipeline with Travis
  • To form part of a larger series of articles that compare various CI/CD services

The repository hosting the project tested and deployed with Travis can be found on GitHub. It’s a small Node/Express application that’s Dockerised and has a single test. I recommend you clone this application and push it up to your own GitHub account so you can build a pipeline while reading this guide.

Read my other CI/CD guides with this same application below:

The article comparing these services:

Pipeline Overview

A diagram showing the steps followed in our CI/CD pipeline can be seen below. Notice how we use Docker Hub to store our Docker images and Elastic Beanstalk to pull and run those…


A guide to continuously integrating and deploying your Dockerised Node.js app to AWS Elastic Beanstalk with Buddy

Image for post
Image for post

Introduction

This piece has two goals:

  • To be a standalone guide to building a CI/CD pipeline with Buddy
  • To form part of a larger series of articles which compare various CI/CD services

The repository hosting the project tested and deployed with Buddy can be found here. It’s a small Node/Express application that’s Dockerised and has a single test. I recommend you clone this application and push it up to your own GitHub account so you can build a pipeline while reading this guide.

Read my other CI/CD guides with this same application below:

The article comparing these services:

Pipeline Overview

A diagram showing the steps followed in our CI/CD pipeline can be seen below. Notice how we use Docker Hub to store our Docker images and Elastic Beanstalk to pull and run those…


A guide to continuously integrating and deploying your Dockerised Node app to AWS Elastic Beanstalk with AWS CodePipeline

Image for post
Image for post

Introduction

This piece has two goals:

  • To be a standalone guide to building a CI/CD pipeline with AWS CodePipeline
  • To form part of a larger series of articles that compare various CI/CD services

The repository hosting the project tested and deployed with CodePipeline can be found on GitHub. It’s a small Node/Express application that’s Dockerised and has a single test. I recommend you clone this application and push it up to your own GitHub account so you can build a pipeline while reading this guide.

Read my other CI/CD guides with this same application below:

The article comparing these services:

Pipeline Overview

A diagram showing the steps followed in our CI/CD pipeline can be seen below. Notice how we use Docker Hub to store our Docker images and Elastic Beanstalk to pull and run those…


A guide to continuously integrating and deploying your Dockerised Node.js app to AWS Elastic Beanstalk with GitLab

Image for post
Image for post

Introduction

This piece has two goals:

  • To be a standalone guide to building a CI/CD pipeline with GitLab
  • To form part of a larger series of articles which compare various CI/CD services

The repository hosting the project tested and deployed with GitLab can be found here. It’s a small Node/Express application that’s Dockerised and has a single test. I recommend you clone this application and push it up to your own GitHub account, so you can build a pipeline while reading this guide.

Read my other CI/CD guides with this same application below:

The article comparing these services:

Pipeline Overview

A diagram showing the steps followed in our CI/CD pipeline can be seen below. Notice how we use Docker Hub to store our Docker images and Elastic Beanstalk to pull and run those…


A guide to continuously integrating and deploying your Dockerised Node app to AWS ElasticBeanstalk with CircleCI

Image for post
Image for post

Introduction

This piece has two goals:

  • To be a standalone guide to building a CI/CD pipeline with CircleCI
  • To form part of a larger series of articles which compare various CI/CD services.

The repository hosting the project tested and deployed with CircleCI can be found here. It’s a small Node/Express application that’s Dockerised and has a single test. I recommend that you clone this application and push it up to your own Github account, so you can build a pipeline while reading this guide.

Read my other CI/CD guides with this same application below:

The article comparing these services:

Pipeline Overview

A diagram showing the steps followed in our CI/CD pipeline can be seen below. Notice how we use Docker Hub to store our Docker images and Elastic Beanstalk to pull and run those…

About

Andrew Bestbier

Hi! I am a JavaScript developer based in London. I love reading and writing about JavaScript, AWS and all things coding.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store