AWS CDK: Deploying sample application on ECS and EC2

In this post, I will be walking through with the steps you need to deploy a sample ECS application on AWS EC2 with the help of AWS CDK.

Lal Verma
7 min readSep 12, 2023
Photo by Mehmet Ali Peker on Unsplash

Pre-Requisites

I am assuming you have awareness on AWS ECS, AWS CDK, AWS EC2 and EC2 Auto Scaling Group.

  • AWS ECS is the container orchestration native platform provided by AWS. If you need more info, please visit the documentation here.
  • AWS CDK, which stands for cloud development kit, is an Infrastructure as a code framework, where you can use your own programming language to develop the infrastructure code. I created an AWS CDK — 101 session on youtube available here.
  • AWS EC2 provides on-demand compute platform on AWS. You can customize your compute platform based on operating system, CPU, memory, etc. If you need more info, you can check more info here.
  • AWS EC2 Auto Scaling helps in automating the scaling behavior of your EC2 instances. If you need a quick overview, you can check my youtube video here.

Overview

If you need to deploy a sample web application on ECS with EC2, this is how the typical architecture will look like.

--

--