Cloud platforms · AWS

Three-tier web application on ALB, ECS Fargate and Aurora

The workhorse for line-of-business web apps: public load balancer, containers across three Availability Zones, a private Aurora PostgreSQL cluster, ElastiCache for sessions and S3 for files.

A reference architecture from EITSAA, not a named client system. Service limits, prices and product features change, so confirm current details before you commit to a design.

  • ACSC Essential Eight
  • SA ISMF and ACSC ISM alignment
  • Australian Privacy Principles (APP 11)
  • Sydney (ap-southeast-2)

Architecture

Architecture diagram. Tinted boundaries show regions, accounts, networks and trust zones. Numbered arrows match the flow below.
Three-tier web application on ALB, ECS Fargate and Aurora architectureUsers to CloudFront + WAF: HTTPS. CloudFront + WAF to Application Load Balancer: HTTPS + secret header. Application Load Balancer to ECS Fargate service: HTTP 8080. ECS Fargate service to Aurora PostgreSQL: TLS 5432. ECS Fargate service to ElastiCache: TLS 6379. ECS Fargate service to VPC endpoints: private. VPC endpoints to S3 uploads: gateway. ECS Fargate service to NAT gateway: 3rd-party APIsInternetAWS workload account · ap-southeast-2VPC 10.20.0.0/16 · 3 Availability ZonesPublic subnetsPrivate app subnetsIsolated data subnetsUsersHTTPSCloudFront + WAFEdge, TLS, rulesApplication LoadBalancerAcross 3 AZsNAT gatewayOutbound onlyECS Fargate serviceTasks in 3 AZs, autoscalingVPC endpointsS3, ECR, Logs, KMSAurora PostgreSQLWriter + 2 readersElastiCacheSessions, hot readsS3 uploadsSSE-KMS, presigned URLs1HTTPS2HTTPS + secret header3HTTP 80804TLS 54325TLS 63796private7gateway3rd-party APIsPlatform servicesAWS IAMAmazonCloudWatchAWS CloudTrailAWS KMS
  • People and clients
  • Network and edge
  • Compute and containers
  • Databases and data
  • Object and file storage
  • Security and identity
  • Monitoring, audit and analytics
  • Request or data flow
  • Asynchronous or optional
  • Boundary: region, account, network or trust zone

Request and data flow

  1. Users reach CloudFront, which terminates TLS and applies WAF managed rules and rate limits.

  2. CloudFront forwards to the ALB over HTTPS with a custom header that the ALB listener rule requires, and the ALB security group only allows the CloudFront managed prefix list.

  3. The ALB distributes to healthy tasks in all three Availability Zones, with connection draining on deployments.

  4. The application reads and writes Aurora through RDS Proxy or a pooled connection over TLS. Credentials come from Secrets Manager with rotation.

  5. Sessions and hot reads use ElastiCache so tasks stay stateless and can be replaced at any time.

  6. Image pulls, logs, secrets and KMS calls go through VPC endpoints, so the tasks need no route to the internet for AWS services.

  7. Uploads go straight from the browser to S3 with presigned URLs, then are virus-scanned before being made available to the app.

Components and why they were chosen

ComponentWhat it doesWhy this choice
Application Load BalancerLayer 7 routing, health checks, TLS and WAF association.Path routing and native ECS integration with slow-start and draining.
Amazon ECS on FargateRuns containers without managing hosts, one task per replica with a task role.No node patching and per-task isolation. EKS is preferred only when Kubernetes is a requirement.
Amazon Aurora PostgreSQLMulti-AZ relational database with shared storage, fast failover and up to 15 readers.Failover is typically faster than classic Multi-AZ RDS and storage grows automatically.
Amazon ElastiCache (Valkey or Redis OSS)In-memory cache for sessions and read-heavy lookups.Keeps the app tier stateless and protects the database from hot keys.
Amazon S3Uploads and generated documents, versioned and encrypted.Takes file traffic off the app and the database.
Amazon ECRPrivate image registry with scan on push.Immutable tags and vulnerability findings in the pipeline.
VPC endpointsPrivate access to S3, ECR, CloudWatch Logs, KMS and Secrets Manager.Removes NAT cost and exposure for AWS traffic.
AWS BackupPolicy-based backups with cross-account copy.Gives a backup the application account cannot delete.

Design decisions and trade-offs

Container platform

ECS on Fargate.

Why. Least operational overhead for teams that do not need Kubernetes features.

Trade-off. Less ecosystem tooling than EKS and higher unit price than well-packed EC2 at steady high load.

Database

Aurora PostgreSQL with a writer and two readers across AZs.

Why. Fast failover, read scaling and managed backups.

Trade-off. Aurora I/O pricing needs checking against Aurora I/O-Optimized for heavy workloads, and it is not portable to another cloud.

Connection management

RDS Proxy or in-app pooling.

Why. Prevents connection storms during scaling or failover.

Trade-off. An extra component and cost.

Egress

Endpoints first, NAT only for third-party APIs.

Why. Reduces cost and blast radius.

Trade-off. More endpoints to manage in Terraform.

Well-architected pillars

Security

Three subnet tiers, security-group-to-security-group rules, no public IPs on tasks, WAF, KMS and Secrets Manager rotation.

Reliability

Three AZs for tasks and database, health-checked rollouts with circuit breaker, automated backups and tested restores.

Performance

Autoscaling on request count and CPU, read replicas for reporting, cache for hot reads, CloudFront for static assets.

Cost optimisation

Fargate vCPU and memory, Aurora instances and I/O, NAT and data transfer. Savings Plans cover the steady baseline.

Operational excellence

Blue/green deployments with CodeDeploy or ECS rolling updates, Terraform for the platform, runbooks for failover and restore.

Sustainability

Right-size tasks, scale in at night for non-production, use Graviton, and stop dev databases out of hours.

Network, identity and data

Networking

A /16 VPC with three tiers per AZ. Public subnets hold only the ALB and NAT. App subnets route to NAT or endpoints. Data subnets have no internet route at all. Flow Logs go to the central log account.

Identity and least privilege

Task execution role (pull images, write logs) is separate from the task role (application permissions). Database access uses IAM database authentication or Secrets Manager rotation. Administrators use Identity Center with break-glass roles.

Data and encryption

Classify per table and column. Aurora, ElastiCache and S3 encrypted with customer-managed KMS keys, TLS enforced everywhere, and snapshots shared only to the backup account.

Security and compliance mapping

ControlHow this design addresses it
Application controlImmutable container images from a scanned registry, only the pipeline can deploy. Essential Eight application control approach for cloud workloads.
Patch applications and operating systemsRebuild images on a schedule and on critical advisories, Fargate platform patched by AWS. Essential Eight.
Multi-factor authenticationMFA for administrators and the application's users. Essential Eight.
Regular backupsAWS Backup with cross-account copy and restore tests. Essential Eight.
Privacy and security of personal informationEncryption, access logging and least privilege support APP 11 expectations.

Mappings show how the design supports each control. They are not certifications, and EITSAA does not claim IRAP assessment or compliance for any reference architecture.

Failure modes, targets and scaling

  • Target RTOUnder a few minutes for AZ failure; 1 to 4 hours for a Region rebuild from IaC and backups
  • Target RPONear zero within the Region; minutes for a cross-Region replica
  • Scaling and limitsAurora writer is a single node, so write scaling is vertical. Beyond that consider sharding or a different store.
Failure modeMitigation
AZ failureTasks and the database span three AZs. ALB removes unhealthy targets. Aurora promotes a reader.
Bad releaseDeployment circuit breaker rolls back automatically. Blue/green with traffic shifting for riskier changes.
Connection exhaustionRDS Proxy, pool limits sized to the max task count, alarms on database connections.
Region failurePilot light or warm standby pattern from the DR page, with a cross-Region Aurora replica if the RTO demands it.

Observability and runbooks

  • Container Insights, ALB target response time and 5xx, Aurora performance insights and slow query log.
  • Alarms on error budget burn rather than raw CPU.
  • Trace sampling with OpenTelemetry and correlation IDs from the edge.
  • Runbooks: failover test, restore from snapshot into a new cluster, rotate credentials.

Cost drivers and levers

Fargate compute, Aurora instance hours and I/O, NAT data processing, CloudFront and WAF.

  • Compute Savings Plans for the baseline.
  • Replace NAT traffic with endpoints.
  • Aurora Serverless v2 for spiky non-production.
  • Schedule down non-production overnight.

Implementation and fit

Phased approach

  1. Foundation: VPC, endpoints, KMS and logging in the landing zone.
  2. Platform: ECS cluster, ALB, Aurora and pipeline with a hello-world service.
  3. Migrate or build the application and run load and failover tests.
  4. Harden: WAF tuning, backup restores, penetration test, then go live.

Anti-patterns to avoid

  • Tasks with public IPs.
  • One shared security group for everything.
  • Database in a public subnet for convenience.
  • Storing sessions or uploads on the container disk.

When to use it

  • Line-of-business and citizen-facing web apps with relational data.
  • Teams standardising on containers.
  • Applications needing predictable latency.

When not to

  • Tiny sites (use the static pattern).
  • Workloads that need Kubernetes operators or custom networking.
  • Very spiky traffic with long idle periods (consider serverless).

More in cloud platforms

Related insights

Discuss this architecture

Tell us your systems, constraints and timeline. We reply within one business day, and the initial conversation is free.