ECS Fargate Containerized Web App Architecture
Run a containerized web application on ECS Fargate and expose it via an Application Load Balancer over HTTPS.
Architecture diagram
AWS services used
Click a service name to review it on the term detail page.
Overview
This architecture runs a containerized web application on Amazon ECS on AWS Fargate and exposes it publicly through an Application Load Balancer (ALB).
Unlike the ECS-on-EC2 model where you manage the underlying EC2 instances yourself, Fargate offloads container runtime infrastructure management to AWS.
It is well suited for cases like "I want to run my Dockerized web app on AWS, but I want to avoid EC2 patching and capacity management."
Architecture Diagram
flowchart TD
User[User]
DNS[Route 53]
ACM[AWS Certificate Manager]
ALB[Application Load Balancer]
VPC[VPC]
PublicSubnet[Public Subnets]
PrivateSubnet[Private Subnets]
ECS[Amazon ECS Service]
Task[Fargate Tasks]
ECR[(Amazon ECR)]
CW[CloudWatch Logs]
IAM[IAM Task Role]User -->|HTTPS| DNS
DNS --> ALB
ACM -.-> ALB
ALB --> PublicSubnet
PublicSubnet --> PrivateSubnet
PrivateSubnet --> ECS
ECS --> Task
Task -->|Pull Image| ECR
Task -->|Logs| CW
IAM -.-> Task
```
What This Architecture Provides
| Item | Description |
|---|---|
| Container execution | Run Dockerized web apps on AWS |
| Reduced server management | Eliminate EC2 instance management overhead |
| HTTPS exposure | Accept HTTPS traffic via ALB and ACM |
| Scaling | Adjust task count via the ECS Service's Desired Count |
| Log visibility | Inspect container logs through CloudWatch Logs |
AWS Services Used
| Service | Role |
|---|---|
| Amazon ECS | Orchestration service that manages and runs containers |
| AWS Fargate | Serverless compute engine that runs containers without server management |
| Amazon ECR | Storage for container images |
| Application Load Balancer | Routes user HTTPS requests to ECS tasks |
| Amazon VPC | Network that hosts ECS tasks and the ALB |
| AWS Certificate Manager | Manages HTTPS certificates |
| Amazon CloudWatch Logs | Stores and inspects container logs |
| IAM | Controls permissions through task execution role and task role |
Request Flow
- The user accesses your custom domain over HTTPS.
- Route 53 resolves the name to the ALB.
- The ALB receives the request.
- The ALB forwards the request to ECS Fargate tasks via the target group.
- The container on the Fargate task processes the request.
- Container logs are written to CloudWatch Logs.
- On deployment, container images are pulled from ECR.
Design Considerations
Availability
Placing ECS tasks across multiple AZs in private subnets improves resilience against a single AZ failure.
The ALB is also deployed across multiple AZs.
Security
Only the ALB sits in public subnets; ECS tasks are placed in private subnets.
The ECS task security group allows traffic only from the ALB.
The task role is granted only the permissions to AWS services that the application actually needs.
Cost
Fargate is billed based on task vCPU, memory, and runtime.
For an individual developer MVP, always-on costs add up quickly, so this AWS certification study site itself prioritizes S3 + CloudFront.
Fargate becomes a reasonable choice once you build a web app that requires persistent server-side processing.
Performance
Tune task count, CPU, and memory according to application load.
Tasks that fail the ALB health check are detached, so make sure the application exposes a proper health check path.
SAA Exam Focus
- ECS is a viable choice as a container execution platform.
- Fargate is the candidate when you want to avoid server management.
- Combine with an ALB for public-facing exposure.
- Placing tasks in private subnets is the standard design.
- Use ECR to store container images.
- Understand the difference between the task execution role and the task role.
Notes on This Architecture
- For an individual MVP, costs tend to exceed S3 + CloudFront.
- Leaving Fargate tasks running incurs ongoing charges.
- The ALB itself has a cost.
- Accessing ECR from private subnets requires either a NAT Gateway or VPC Endpoint design.
- Misconfigured health checks can detach healthy tasks.
Related Terms
Related Comparisons
Role in this Project
ECS Fargate is a strong option for running containerized web apps without managing servers.
However, for an individual MVP centered on a static site, fixed costs tend to grow, so this project treats this architecture as a study reference and prioritizes S3 + CloudFront for the main site.
Explore more AWS architectures
For the SAA exam, understanding AWS as architecture patterns matters more than memorizing individual services.
Related architectures
Static Hosting
S3 + CloudFront Static Website Architecture
Explains the baseline architecture for delivering a static site placed in S3 quickly and securely through CloudFront.
Serverless
API Gateway + Lambda + DynamoDB Serverless API Architecture
A foundational serverless API architecture that uses API Gateway as the entry point, executes processing in Lambda, and stores data in DynamoDB. Suited for contact forms and small-scale APIs.
Three Tier
Three-Tier Web Application Architecture in a VPC
A foundational three-tier web app architecture on AWS that separates the web, application, and database layers across Public Subnets, Private Subnets, and Database Subnets.