DEV Community

Cover image for Strangler Fig Migration Strategy on AWS
Axel
Axel

Posted on • Edited on

Strangler Fig Migration Strategy on AWS

Strangler Fig pattern in AWS refers to a migration strategy used to gradually transition from a monolithic architecture to a microservices-based architecture. Inspired by the natural growth of strangler fig trees explain here by Martin Fowler, this pattern allows for the incremental replacement of parts of an existing legacy system with new components, without the need for a complete rewrite or shutdown of the old system.

Key Concepts of the AWS Strangler Fig Pattern

Incremental Migration: Start by migrating specific features or services to a new microservices architecture, leaving the rest of the monolith intact. Over time, more features are "strangled" out of the monolith and into the new system.

Dual Systems: Both the monolith and the new microservices operate concurrently, with requests being routed to either system depending on where the functionality resides.

Routing Control: AWS services like API Gateway, Lambda, and Application Load Balancer can help control routing between the monolith and microservices, gradually phasing out the old system.

Low-Risk Transition: The gradual approach allows for testing and refining each component in isolation, minimizing disruption to the business.

Scalability and Modernization: The eventual goal is to retire the legacy system entirely, leaving behind a more scalable, flexible, and cloud-native microservices architecture.

Use case

AWS Strangler fig

In this scenario, we have a legacy monolithic backend application and a modernized architecture where services are split into microservices. The Add Booking service has been extracted into a microservice, deployed on AWS Lambda, which stores booking data in DynamoDB.

Optional: A DynamoDB Stream is used to sync data from the modern microservice to the legacy database.

When a customer creates a new aircraft booking, the API Gateway routes the request to the new Add Booking microservice (e.g., /aircraft/book). For other endpoints, the API Gateway forwards requests to the legacy backend.

Conclusion

This pattern is often employed when organizations need to modernize their legacy applications while maintaining ongoing functionality. AWS services play a crucial role in facilitating this smooth migration process.

Top comments (0)