May 1, 2026 · 6 min read

Deploying Node on AWS EC2

awsdeploymentnode

Why EC2

For projects like Shixa, a long-running Node API fits a VPS better than pure serverless. EC2 gives a known Linux host you can inspect when things break.

Baseline setup

  1. Provision Ubuntu LTS; open only 22 (your IP), 80, and 443
  2. Non-root deploy user with key-based SSH
  3. Node via a version manager, Nginx as reverse proxy, Certbot for TLS

Process model

Run the app under PM2 or systemd so restarts and logs are boring. Bind to localhost; let Nginx terminate TLS. Keep secrets out of the repo.

What I watch

  • Disk and memory growth
  • 5xx rate after deploys
  • Certificate renewal success

Deploy is not “it works on the server once.” Deploy is “I can ship again next week without fear.”

Treat the host like a product surface: least privilege, reverse proxy, managed process, boring rollbacks.