Every realistic way to run a Node.js backend on AWS, ranked by how much you set up yourself, with commands for each and what changed when App Runner closed.

The easiest way to deploy a Node.js backend to AWS in 2026 depends on what the backend needs. For one stateless container, use ECS Express Mode, which AWS recommends now that App Runner is closed to new customers. For a TypeScript backend that also needs Postgres, queues, cron jobs or file storage, use Encore: you declare those resources in the code and Encore provisions RDS, SNS/SQS, S3 and Secrets Manager in your own AWS account on git push. Use Lambda for event-driven work, and Terraform or CDK when someone on the team wants to own every resource.
Every option below runs Node.js in your AWS account. They differ in how much of the surrounding infrastructure (load balancer, database, queues, secrets, IAM, scheduled jobs) you write and maintain yourself.
AWS App Runner is no longer on this list: AWS closed it to new customers on April 30, 2026 and points to ECS Express Mode instead; existing customers can keep using it.
Verdict. If the app is one container with no state, ECS Express Mode is the shortest AWS-native path. Most Node.js backends grow a database, a background worker and a nightly job, and those are where the setup time goes. Encore ranks first because it provisions all of them, plus the service, in your AWS account from the code you already write.
Encore is infrastructure from code. The application declares the database, topics, buckets, cron jobs and secrets it uses. encore run starts local versions of the database, topics and buckets; cron jobs are managed by the Encore platform and do not run locally or in preview environments. A push deploys the app and provisions the matching AWS resources in your own account. Here is a signup service with Postgres, a background job and a scheduled cleanup:
// users/users.ts (encore.dev 1.58)
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic, Subscription } from "encore.dev/pubsub";
import { CronJob } from "encore.dev/cron";
import { secret } from "encore.dev/config";
// RDS for PostgreSQL in your AWS account; a local Postgres under `encore run`.
const db = new SQLDatabase("users", { migrations: "./migrations" });
// Stored in AWS Secrets Manager.
const resendKey = secret("ResendApiKey");
interface UserSignedUp {
userId: string;
email: string;
}
// SNS topic with an SQS queue and a dead-letter queue.
export const signups = new Topic<UserSignedUp>("signups", {
deliveryGuarantee: "at-least-once",
});
export const signup = api(
{ method: "POST", path: "/signup", expose: true },
async ({ email }: { email: string }): Promise<{ id: string }> => {
const row = await db.queryRow<{ id: string }>`
INSERT INTO users (email) VALUES (${email}) RETURNING id::text AS id`;
await signups.publish({ userId: row!.id, email });
return { id: row!.id };
},
);
const _ = new Subscription(signups, "welcome-email", {
handler: async ({ email }) => {
const res = await fetch("https://api.resend.com/emails", {
method: "POST",
headers: { Authorization: `Bearer ${resendKey()}`, "Content-Type": "application/json" },
body: JSON.stringify({ from: "hi@example.com", to: email, subject: "Welcome", text: "Thanks for signing up." }),
});
if (!res.ok) throw new Error(`Resend returned ${res.status}`); // retried, then dead-lettered
},
});
export const purgeUnverified = api({ method: "POST", path: "/internal/purge-unverified" }, async () => {
await db.exec`DELETE FROM users WHERE verified = false AND created_at < NOW() - INTERVAL '30 days'`;
});
// Run by the Encore platform on schedule in deployed environments.
const _purge = new CronJob("purge-unverified", {
title: "Purge unverified accounts",
schedule: "0 3 * * *",
endpoint: purgeUnverified,
});
brew install encoredev/tap/encore # or: curl -L https://encore.dev/install.sh | bash
encore app create my-app # pick TypeScript and a starter template
encore run # local Postgres, queue and tracing
git push encore main # deploy to the connected AWS account
Connect your AWS account once, and each push provisions what the code declares: Fargate (or EKS) behind a load balancer, RDS, SNS/SQS, Secrets Manager, CloudWatch logs and a VPC with private subnets for the tasks and databases. Encore provisions an IAM role for the service. Each pull request gets a preview environment. Cron jobs are managed by the Encore platform and need no extra AWS resource; they do not fire under encore run or in preview environments, so test the endpoint by calling it. Later built an event-driven matching engine this way on their own AWS account.
Encore is a framework, so an existing Express or NestJS app is ported endpoint by endpoint rather than deployed as is; the Express migration guide maps routes and middleware. If you need to keep the current code unchanged for now, use ECS Express Mode for the web tier.
Express Mode runs a container image. Build one, push it to ECR, and create the service:
# Dockerfile
FROM node:22-slim
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 8080
CMD ["node", "server.js"]
docker build --platform linux/amd64 -t $ACCOUNT.dkr.ecr.us-east-1.amazonaws.com/my-api:v1 .
docker push $ACCOUNT.dkr.ecr.us-east-1.amazonaws.com/my-api:v1
aws ecs create-express-gateway-service \
--service-name my-api \
--execution-role-arn arn:aws:iam::$ACCOUNT:role/ecsTaskExecutionRole \
--infrastructure-role-arn arn:aws:iam::$ACCOUNT:role/ecsInfrastructureRoleForExpressServices \
--primary-container '{"image": "'$ACCOUNT'.dkr.ecr.us-east-1.amazonaws.com/my-api:v1", "containerPort": 8080}' \
--health-check-path /health
The app must listen on 0.0.0.0 and the container port (process.env.PORT ?? 8080). Express Mode creates the Fargate service, a load balancer with HTTPS, autoscaling and a *.ecs.us-east-1.on.aws URL. The database, its network path, secrets and any worker are separate. The full walkthrough, including the two IAM roles, Secrets Manager and private subnets for RDS, is in ECS Express Mode: Deploy a Container to AWS With One Command.
This is the same Fargate runtime with every resource written out: a VPC with public and private subnets, an ALB with an HTTPS listener and ACM certificate, a target group, a task definition, an ECS service, security groups, a task role and an execution role, an ECR repository, CloudWatch log groups, RDS, and a CI job that builds, pushes and updates the service. In CDK, ApplicationLoadBalancedFargateService from aws-cdk-lib/aws-ecs-patterns collapses the service, load balancer and target group into one construct:
// lib/api-stack.ts (aws-cdk-lib 2.x)
import * as ec2 from "aws-cdk-lib/aws-ec2";
import * as ecs from "aws-cdk-lib/aws-ecs";
import * as patterns from "aws-cdk-lib/aws-ecs-patterns";
import * as rds from "aws-cdk-lib/aws-rds";
const vpc = new ec2.Vpc(this, "Vpc", { maxAzs: 2 });
const db = new rds.DatabaseInstance(this, "Db", {
engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_16 }),
vpc,
storageEncrypted: true,
});
const api = new patterns.ApplicationLoadBalancedFargateService(this, "Api", {
vpc,
cpu: 512,
memoryLimitMiB: 1024,
taskImageOptions: {
image: ecs.ContainerImage.fromAsset("."),
containerPort: 8080,
secrets: { DATABASE_SECRET: ecs.Secret.fromSecretsManager(db.secret!) },
},
});
db.connections.allowDefaultPortFrom(api.service);
That is the shortest version, before HTTPS, autoscaling, queues and scheduled jobs. Pick this path when a platform engineer wants the full resource graph in reviewed code.
// handler.ts (Node.js 22 runtime)
import type { APIGatewayProxyHandlerV2 } from "aws-lambda";
export const handler: APIGatewayProxyHandlerV2 = async (event) => {
const id = event.pathParameters?.id;
return { statusCode: 200, body: JSON.stringify({ id }) };
};
Package it as a zip or a container image and expose it through API Gateway or a Lambda function URL with SAM, SST, the Serverless Framework or CDK. Lambda scales to zero and bills per request and duration, so a low-traffic API costs close to nothing. The costs show up elsewhere: cold starts on the first request, a 15-minute maximum run time, and a new database connection per concurrent instance, which is why Lambda in front of RDS usually needs RDS Proxy. Running an existing Express app on Lambda needs an adapter, and each handler becomes its own deploy unit.
Elastic Beanstalk uploads your code to EC2 instances behind a load balancer: eb init -p node.js my-app, eb create my-app-prod, eb deploy. It still works and AWS still supports it, but customization lives in .ebextensions files, platform versions need upgrading, and the database and workers are still yours. It makes sense when a monolith already runs there.
EC2 gives you a virtual machine: install Node.js, run the app under systemd or pm2, put a load balancer or nginx with TLS in front, and own patching, scaling and logs. Pick it only for a runtime need the managed options cannot meet.
Approximate on-demand list prices in us-east-1 for one small always-on API, before the database and data transfer:
Check the Fargate and Elastic Load Balancing pricing pages for your region. A small RDS for PostgreSQL instance usually costs more than the compute for a service this size.
To try the Encore path, start with the quickstart, then connect your AWS account.
Windows: iwr https://encore.dev/install.ps1 | iex
Linux: curl -L https://encore.dev/install.sh | bash
For a single stateless container, ECS Express Mode is the easiest AWS-native option: give it an image and two IAM roles and it creates a Fargate service, a load balancer with HTTPS, autoscaling and a URL. For a TypeScript backend that also needs Postgres, queues, cron jobs or file storage, Encore is easier overall, because it provisions RDS, SNS/SQS, S3 and Secrets Manager in your own AWS account from declarations in the code and deploys on git push.
No, not as a new customer. AWS closed App Runner to new customers on April 30, 2026 and recommends ECS Express Mode instead. Existing App Runner services keep running, but AWS does not plan new features.
Use Fargate (through ECS Express Mode, Encore or Terraform) for an always-on HTTP API, WebSockets, long requests or a steady connection pool to Postgres. Use Lambda for event-driven handlers and traffic that is near zero most of the day, and plan for cold starts, the 15-minute limit and RDS Proxy for database connections.
On Fargate in us-east-1, one task with 0.5 vCPU and 1 GB of memory running all month costs roughly 18 dollars at on-demand list prices, and an Application Load Balancer adds roughly 16 to 20 dollars, before the database and data transfer. Lambda can cost close to nothing at low traffic and more than Fargate at steady high traffic.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.