Bablu Kumar Singh
Back to Blog
DevOps
4 min read
June 9, 2026

AWS for Backend Developers: Essential Services and Architecture Patterns

AWS for Backend Developers: Essential Services and Architecture Patterns

AWS has a few hundred services, and you need maybe a dozen of them to actually run a backend in production. This is the short list, based on what I've used, not the full catalog.

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 t3 instances with burstable performance for development environments.

Wrapping Up

EC2, ALB, ASG, RDS, S3, SQS, and ElastiCache cover most of what a backend actually needs from AWS. Set a billing alarm before you need one — cloud costs have a way of growing quietly until they don't.

#AWS#EC2#Cloud#DevOps
Bablu Kumar Singh
Written by

Bablu Kumar Singh

Backend-Focused Full Stack Developer

Writes about backend systems and databases based on what comes up while building with Node.js, MongoDB, PostgreSQL, and Redis.

You May Also Like

Docker Deployment for Node.js Applications: A Production Guide
DevOps
4 min read

Docker Deployment for Node.js Applications: A Production Guide

Learn how to containerize Node.js applications with multi-stage Docker builds, optimize image sizes, handle environment variables, and deploy with Docker Compose for development and production.

Jun 6, 2026Read
Building a Multi-Tenant SaaS: Database Architecture Strategies
System Design
2 min read

Building a Multi-Tenant SaaS: Database Architecture Strategies

An evaluation of pool database systems vs. schema-based and table-level tenant isolation patterns for microservices.

Jun 1, 2026Read
RabbitMQ Event Processing Patterns for Scalable Systems
System Design
4 min read

RabbitMQ Event Processing Patterns for Scalable Systems

A deep dive into event-driven architecture with RabbitMQ — covering exchanges, queues, dead-letter handling, retry strategies, and real-world patterns for Node.js microservices.

May 14, 2026Read