Advanced Fintech & SaaS Strangler Fig ECS Fargate

Monolith to Microservices: Strangler Fig Pattern on AWS Fargate

Incrementally decomposing a monolithic application into Dockerized microservices deployed on Amazon ECS with AWS Fargate and ALB path-based routing.

Estimated Reading Time: 9 mins
AWS Services: 4 integrated
Production Benchmark & ROI Targets
Deployment Frequency
Daily (from monthly)
Infrastructure Management
0 EC2 instances
Migration Downtime
0 minutes

1. Business Problem & Context

A fintech SaaS company maintained a 10-year-old monolithic Rails application. Deploying a minor bug fix to the authentication code required re-testing and deploying the entire 2-gigabyte codebase. A single memory leak in the billing module crashed the entire customer-facing platform.

2. Requirements & Constraints

  • Zero-Risk Migration: Avoid a high-risk “Big Bang” rewrite; incrementally strangle features out of the monolith.
  • No Server Maintenance: The team had no dedicated Kubernetes/SRE engineers and needed serverless container management.
  • Path-Based Ingress: Transparently route traffic between legacy monolith and new microservices without breaking API URLs.

3. Architecture Overview & Data Flow

Strangler Fig Migration Topology on ECS Fargate
Rendering Architecture Topology...

Interactive Architecture Diagram (Use controls to zoom & pan)

  1. Identify Boundary: Isolated the /api/auth domain as the first candidate for extraction.
  2. Build Containerized Service: Packaged the new lightweight Node.js/Go service into a Docker image and pushed to Amazon ECR.
  3. Deploy to ECS Fargate: Created an ECS Service with Target Tracking autoscaling (50% CPU).
  4. Shift ALB Rule: Updated the ALB listener rule to route /api/auth/* to the Fargate Target Group while keeping all other traffic on the legacy monolith.

4. AWS Services Used & Rationales

AWS Services Architecture Rationale

Concrete reasons why these specific services were chosen over alternatives

Service Category Architectural Rationale ("Why this service?")
Amazon ECS with AWS Fargate Containers Runs containers with task-level CPU and memory isolation without managing worker node EC2 VMs.
Application Load Balancer Networking Provides path-based routing rules that decouple external URLs from internal service locations.
Amazon ECR Containers Stores encrypted container images with automated Clair vulnerability scanning.

5. Key Design Trade-offs

Architecture Decision & Trade-Off Matrix

Evaluating alternative approaches under real-world constraints

Big Bang Rewrite to Amazon EKS (Kubernetes)

  • + Complete Kubernetes feature set
  • High operational complexity
  • High risk of 6-12 month delivery delay
  • Requires dedicated SREs
Architectural Verdict: Unacceptable business risk.

Incremental Strangler Fig on ECS Fargate (Chosen)

✓ Chosen Design
  • + Zero downtime migration
  • + Zero node management
  • + Continuous value delivery every sprint
  • Temporary dual-running costs for monolith and microservices
Architectural Verdict: Safest, most cost-effective path to modern microservices.

6. Implementation Highlights

Terraform ALB Listener Rule Path Routing Pattern
resource "aws_lb_listener_rule" "auth_microservice" {
  listener_arn = aws_lb_listener.front_end.arn
  priority     = 10

  action {
    type             = "forward"
    target_group_arn = aws_lb_target_group.auth_fargate.arn
  }

  condition {
    path_pattern {
      values = ["/api/auth/*", "/oauth/*"]
    }
  }
}

7. Results & Key Metrics

  • Release Speed: Feature deployment frequency increased from monthly to multiple times daily.
  • Blast Radius Containment: Payment processing outages zeroed out due to complete container process isolation.

8. Key Architectural Takeaways

Strangler Fig Law: Never attempt a 100% ground-up rewrite of a production monolith. Use ALB path routing and containerized Fargate tasks to extract one domain at a time.

9. Interactive Knowledge Check

Architecture Knowledge Check
Question1of1
Question01

What is the key operational difference between ECS on EC2 vs ECS on AWS Fargate?

10. Official AWS References