articles / scalabilite-horizontale-verticale-aws

Horizontal or vertical scaling on AWS: the pragmatic approach

Mounir Guizani · 29 November 2026 · 5 min read

  • aws
  • scalabilite
  • ecs
  • lambda

"Will it handle the load?" is often a client's first question. On AWS there are two answers, vertical scaling and horizontal scaling, and the right choice depends less on the technology than on the nature of the application. Here is how I reason about it, with concrete examples, including this portfolio.

The two directions

  • Vertical (scale up): give more power to the same machine: more CPU, more memory.
  • Horizontal (scale out): add more identical machines, and spread the work across them.
Vertical Horizontal
Implementation simple: change a size requires a stateless application
Ceiling the largest machine available virtually unlimited
Interruption often a restart none: instances are added live
Resilience a single point of failure one instance fails, the others carry on
Cost sometimes steep steps proportional to the load
Ideal for relational databases, monolithic jobs APIs, workers, parallelisable jobs

On AWS, service by service

Service Vertical Horizontal
EC2 change the instance type auto scaling group behind a load balancer
ECS / Fargate increase the task's CPU and memory increase the number of tasks (service auto scaling)
Lambda increase memory (CPU follows, up to 10 GB) automatic: one execution per concurrent request
RDS / Aurora change the instance class read replicas (up to 15 with Aurora)
DynamoDB not applicable automatic (partitions, on-demand mode)
SQS not applicable unlimited queue, consumers added at will

The condition for horizontal: being stateless

Adding instances is pointless if each one keeps information the others don't have. The rules:

  • no in-memory sessions: a token (JWT) or shared storage (Redis, DynamoDB);
  • no durable local files: S3;
  • idempotent processing: a message processed twice must not produce two effects;
  • distributed locks when only one instance must act (a scheduled task, for example).

Example 1: this portfolio

The site is built for horizontal scaling, with nothing to tune:

  • pages are static files on S3, served by CloudFront from hundreds of points of presence;
  • the API is a Lambda: AWS creates as many executions as there are concurrent requests;
  • data lives in DynamoDB, which spreads the load across its partitions.

A traffic spike needs no intervention, and cost follows traffic.

Example 2: a Spring Boot API on ECS

A target tracking policy keeps, for instance, average CPU around 60%: ECS adds tasks when the load rises and removes them when it drops. You set a minimum (availability) and a maximum (budget, and protecting the database behind it).

Example 3: a high-volume Spring Batch job

A job processing millions of rows can scale both ways:

  • vertically: a bigger task, more threads, larger chunks;
  • horizontally: Spring Batch partitioning splits the data into ranges, each processed by its own ECS task in parallel.

The real ceiling is often the database: ten workers in parallel also multiply the write load. Size both together.

Common traps

  • Scaling the API without scaling the database: the bottleneck simply moves one step.
  • Scaling on the wrong metric: CPU says nothing about a service waiting on network calls; prefer request count or SQS queue depth.
  • Forgetting start-up time: an instance that takes a minute to start arrives after the peak. Anticipate (lower thresholds, scheduled scaling) or start faster (native image).
  • Never testing: a load test before going live beats any assumption.

My pragmatic rule

  1. Start simple: a reasonable, measured size.
  2. Design stateless from day one, even if you don't scale right away: that's what is expensive to fix later.
  3. Scale compute horizontally (APIs, workers), the relational database vertically then with replicas, and let managed services (Lambda, DynamoDB, SQS, S3) do the work when they can.
  4. Measure, then adjust: CloudWatch before intuition.