Wiki › Project

Node.js service on EC2 with IaC

Article
From Chaipat's knowledge graph

Node.js service on EC2 with IaC solves roadmap.sh's Node.js deployment challenge. It combines two infrastructure tools: Terraform creates the server, and Ansible configures it and deploys the app.

Layers

  1. Infrastructure (infra): Terraform creates an EC2 instance on AWS EC2 and restricts SSH to known addresses.
  2. Configuration (ansible): roles and playbooks install Node.js, deploy the service and run it, using Jinja2 templates for its configuration.
  3. Delivery (.github/workflows): a GitHub Actions workflow redeploys the service on every push.

A Makefile ties the three together, with targets for Terraform, Ansible and connecting over SSH.

See also