AWS offers over 200 services, but as a backend developer you need to master about a dozen to deploy, scale, and operate production applications confidently. This guide cuts through the noise and focuses on the services that matter most for backend engineering — written by Bablu Kumar Singh from hands-on production experience.
The Core Architecture
A production-ready AWS architecture for a Node.js API looks like this:
Internet
│
▼
Route 53 (DNS)
│
▼
CloudFront (CDN)
│
▼
ALB (Application Load Balancer)
│
├──▶ EC2 Instance 1 (Node.js API)
├──▶ EC2 Instance 2 (Node.js API)
└──▶ EC2 Instance 3 (Node.js API)
│
├──▶ RDS (PostgreSQL / MongoDB Atlas)
├──▶ ElastiCache (Redis)
└──▶ S3 (File Storage)
EC2: Your Application Server
EC2 (Elastic Compute Cloud) provides virtual machines. For a Node.js API:
Instance type:
t3.medium(2 vCPUs, 4 GB RAM) is a solid starting point.AMI: Amazon Linux 2023 or Ubuntu 22.04.
Security Group: Allow inbound on port 3000 from the ALB only, SSH on port 22 from your IP only.
Basic setup script (User Data):
#!/bin/bash
# Install Node.js 20
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
yum install -y nodejs git
# Clone and start application
cd /home/ec2-user
git clone https://github.com/your-org/your-api.git
cd your-api
npm ci --only=production
npm run build
# Use PM2 for process management
npm install -g pm2
pm2 start dist/index.js --name api -i max
pm2 save
pm2 startup
Application Load Balancer (ALB)
The ALB distributes traffic across EC2 instances and provides:
Health checks — automatically removes unhealthy instances.
SSL termination — handles HTTPS so your Node.js app only deals with HTTP.
Path-based routing — route
/api/*to backend,/*to frontend.
Key configuration:
Listener: HTTPS :443
Rule 1: Path /api/* → Target Group: backend-tg
Rule 2: Default → Target Group: frontend-tg
Target Group: backend-tg
Health Check Path: /api/health
Health Check Interval: 30s
Healthy Threshold: 2
Unhealthy Threshold: 3
Auto Scaling Group (ASG)
Auto Scaling automatically adjusts the number of EC2 instances based on demand:
Auto Scaling Group:
Min Instances: 2
Max Instances: 10
Desired Capacity: 3
Scaling Policy (Target Tracking):
Metric: Average CPU Utilization
Target: 60%
Scale Out Cooldown: 300s
Scale In Cooldown: 300s
When CPU utilization exceeds 60 %, ASG launches new instances. When it drops, instances are terminated. You pay only for what you use.
RDS: Managed Databases
Amazon RDS handles database administration — backups, patching, replication, and failover. For PostgreSQL:
Instance: db.t3.medium
Storage: 100 GB gp3
Multi-AZ: Enabled (automatic failover)
Automated Backups: 7-day retention
Connection from Node.js:
import { Pool } from 'pg';
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
max: 20,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 5000,
ssl: { rejectUnauthorized: false },
});
S3: Object Storage
S3 stores files (user uploads, backups, static assets) with 99.999999999 % durability:
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
const s3 = new S3Client({ region: 'ap-south-1' });
async function uploadFile(key: string, body: Buffer, contentType: string) {
await s3.send(
new PutObjectCommand({
Bucket: process.env.S3_BUCKET!,
Key: key,
Body: body,
ContentType: contentType,
})
);
return `https://${process.env.S3_BUCKET}.s3.amazonaws.com/${key}`;
}
Combine S3 with CloudFront for global CDN delivery of uploaded images and files.
SQS: Message Queues
Amazon SQS is a fully managed message queue. Use it for background job processing:
import { SQSClient, SendMessageCommand, ReceiveMessageCommand } from '@aws-sdk/client-sqs';
const sqs = new SQSClient({ region: 'ap-south-1' });
const QUEUE_URL = process.env.SQS_QUEUE_URL!;
// Producer
async function enqueueJob(payload: object) {
await sqs.send(
new SendMessageCommand({
QueueUrl: QUEUE_URL,
MessageBody: JSON.stringify(payload),
})
);
}
// Consumer (runs on a separate worker instance)
async function pollJobs() {
const response = await sqs.send(
new ReceiveMessageCommand({
QueueUrl: QUEUE_URL,
MaxNumberOfMessages: 10,
WaitTimeSeconds: 20, // long polling
})
);
return response.Messages || [];
}
ElastiCache: Managed Redis
ElastiCache provides managed Redis or Memcached. For session caching and API response caching:
Node Type: cache.t3.medium
Cluster Mode: Disabled (single-shard is enough for most APIs)
Multi-AZ: Enabled
Automatic Failover: Enabled
Your application connects to ElastiCache the same way it connects to local Redis — just update the REDIS_URL environment variable.
Cost Optimization Tips
Use Reserved Instances for predictable workloads (save up to 60 %).
Use Spot Instances for batch processing and non-critical workers.
Enable S3 lifecycle policies to transition old objects to Glacier.
Set up CloudWatch billing alarms to avoid surprise bills.
Use
t3instances with burstable performance for development environments.
Key Takeaways
Master the core seven: EC2, ALB, ASG, RDS, S3, SQS, and ElastiCache.
Design for Multi-AZ from the start — availability is non-negotiable.
Use Auto Scaling so infrastructure matches demand automatically.
Separate compute from storage — stateless servers + managed databases.
Watch your costs — cloud bills grow silently without alarms and reviews.
AWS is a force multiplier for backend developers. These services handle the undifferentiated heavy lifting so you can focus on building features that matter.
