🔙 Backjoeygoksu.com

Deploy NestJS app to AWS ECS using Pulumi [Quick Tutorial]

software

February 06, 2022

Pulumi is my favorite tool. It’s a great tool for building and deploying apps to the cloud platforms such as AWS, Azure, Google Cloud, etc. I’ve been using it for a while now and I’m very happy with the experience. Extremely easy to use and very powerful.

Hands-on Lab

  1. Create a new Pulumi project

    $ pulumi new my-project
    
    $ cd my-project
  2. Install Pulumi NPM dependencies and import to the related js/ts file
Pulumi NPM dependencies and import to the related js/ts file
  1. Define the credientials for Container
Define the credientials for Container
  1. Create a VPC, Gateway and Route Table
Create a VPC, Gateway and Route Table

In that point I want to show you an AWS Architecture diagram.

AWS Architecture diagram

You can see the best practices for creating a VPC, Subnets etc.. but we don’t need to create them for this lab.

  1. Create a S3 Bucket for storing the static files (I assume we also have frontend app)
Create a S3 Bucket for storing the static files
  1. We almost done. We need to create an Elastic Load Balancer to reach the server app. After that we will create a AWS ECS fargate task definition. The task definition will be used to create a ECS cluster. It will also build our docker image and push it to the ECR.
We almost done. We need to create an Elastic Load Balancer to reach the server app. After that we will create a AWS ECS fargate task definition. The task definition will be used to create a ECS cluster. It will also build our docker image and push it to the ECR.
  1. Let’s execute the following commands to run the IaC.
    $ pulumi up
  1. Go to the pulumi dashboard and see the output. That’s all. :)

See you in the next lab.

awsecsnestjspulumideployment

Crafted with ❤️ in multiple locations [🇬🇧 🇺🇸 🇹🇷 🇷🇺]. · © 2022