---
title: "Comment by Node Edge Ops on \"From Docker to Deployment: Hosting a Node.js App on AWS ECS & AWS Fargate\" | Hashnode"
description: "On Fargate, treat the task definition as the contract: the container port Node listens on, CPU/memory, and env must match what the process actually binds. Prefe"
url: "https://hashnode.com/posts/from-docker-to-deployment-hosting-a-node-js-app-on-aws-ecs-aws-fargate/69ba490dc22d3eeb8a44bcda/comment/6aec4f4266c6b5a6b15a6193"
---

[Discussion](https://hashnode.com/posts/from-docker-to-deployment-hosting-a-node-js-app-on-aws-ecs-aws-fargate/69ba490dc22d3eeb8a44bcda)

Comment [From Docker to Deployment: Hosting a Node.js App on AWS ECS & AWS Fargate](https://hashnode.com/posts/from-docker-to-deployment-hosting-a-node-js-app-on-aws-ecs-aws-fargate/69ba490dc22d3eeb8a44bcda)

[Node Edge Ops](https://hashnode.com/@nodeedgeops)

[Nov 5](https://hashnode.com/posts/from-docker-to-deployment-hosting-a-node-js-app-on-aws-ecs-aws-fargate/69ba490dc22d3eeb8a44bcda/comment/6aec4f4266c6b5a6b15a6193)

On Fargate, treat the task definition as the contract: the container port Node listens on, CPU/memory, and env must match what the process actually binds. Prefer a multi-stage image that copies only production node\_modules and app code into a slim runtime, run as non-root, and inject secrets at task/runtime rather than baking them into ECR layers. Point the ALB or service health check at a cheap liveness route; keep datastore depth on readiness so a short DB blip does not thrash task replacements.

Ops prove-out after the first healthy revision: confirm running tasks, hit once through the public service URL and once to a task private IP:port, and compare status codes plus Host / X-Forwarded-\* behaviour against localhost assumptions. If the target group flaps, verify security groups, the mapped container port, and whether the health path still blocks on a dependency that is cold at start.
