Implementing the Strangler Fig Pattern with AWS Migration Hub Refactor Spaces - Incremental Microservices Migration

Learn how to implement the strangler fig pattern with Refactor Spaces, control routing, and execute incremental migrations to microservices.

Refactor Spaces Overview

Refactor Spaces is a service that supports incremental migration from monolithic applications to microservices, managing up to 50 services and 100 routes. It automatically builds the infrastructure needed to implement the strangler fig pattern (API Gateway, routing, inter-VPC connectivity) and enables feature-by-feature migration through URL path-based routing. It also supports multi-account configurations.

Implementing the Strangler Fig Pattern

When you create an environment, an API Gateway is built as a proxy, and all traffic is routed to the monolith. Once a new microservice is developed, you switch the route for the corresponding URL path (e.g., /api/orders) to the new service. The remaining paths continue to route to the monolith. You incrementally add routes, and once all paths have been migrated to new services, you decommission the monolith. If issues arise, simply deleting the route instantly reverts traffic back to the monolith.

Routing and Multi-Account Support

Refactor Spaces routes consist of a default route (fallback to the monolith) and service routes (forwarding to microservices). URL path-based routing sends /api/orders to the new microservice while everything else goes to the monolith. In a multi-account configuration, you can place the monolith and microservices in different accounts to enforce security boundaries. Adding a new microservice only requires creating a service and a route; Refactor Spaces automatically manages the API Gateway configuration changes. To learn migration strategies with Refactor Spaces comprehensively, check out technical books (Amazon).

Refactor Spaces Pricing

Refactor Spaces itself incurs no additional charges. Costs depend on the automatically provisioned resources: API Gateway, NLB, and Transit Gateway. API Gateway request pricing (approximately $3.50 per million requests) is the primary cost driver. After migration is complete, decommissioning the monolith and deleting the Refactor Spaces environment also stops the proxy resource charges.

Summary

Refactor Spaces automatically builds the infrastructure for the strangler fig pattern, supporting incremental migration from monoliths to microservices. URL path-based routing enables feature-by-feature migration, and multi-account configurations enforce security boundaries. Adding a new microservice only requires creating a service and a route, with API Gateway configuration changes managed automatically.