The Strangler Pattern: Microservices Design Patterns In Practice Made Easy with AWS Serverless
In this article, I will explain the famous Microservices Migration Pattern invented by Martin Fowler, “The Strangler Pattern”. In addition, I will go into details explaining how to build it using AWS Serverless AppSync and Amplify
This article is part of a series to explain Microservices Design Patterns in Practice
In the following video, I will explain the famous Microservices Migration Pattern invented by Martin Fowler, “The Strangler Pattern”. In addition, I will go into details explaining how to build it using AWS Serverless AppSync and Amplify
This patter was first invented by Martin Fowler when he saw the strangled Fig trees
We use the same approach to migrate (strangle) from the monolith applications to Microservices
First, we build a Strangler Facade (I used AppSYnc in the Hands on)
Second, we identify one functionality that can be separated and move it to a Microservice in a progressive way. We build the Microservice first and then migrate the functionality
In the end, the Microservices will strangle the legacy Monolith until it dies.
The remaining of the article will be hands-on to build a GraphQL Microservice using AWS AppSync and Amplify
Building a GraphQL Microservice with AWS AppSync and Amplify
I would like to create a GraphQL Microservice. AWS Amplify and AppSync made it extremely easy to build Serverless and Codeless Microservice in just few minutes. The best way to show the difference, is to create a Microservice together.
In this short article, I will explain how I have built a GraphQL AppSync endpoint at work using AWS Amplify and I will explain using screenshots (one photo is better than bunch of words :))
Final code can be found at
Detailed walkthrough in the following video:
In this short video, I will explain how I have built a GraphQL AppSync Microservice using AWS Amplify
Here are the steps that I followed in the previous video
- Install amplify cli
sudo npm install -g @aws-amplify/cli
2. create a react app as explained in another article
npx create-react-app graqhql-microservice
3. after it finishes, enter the directory and open VS code
cd graqhql-microservice
code .
4. initialize amplify
amplify init
5. Add API
amplify add api
6. Push changes to AWS cloud
amplify push
- After building your Schema, you need to configure Amplify to inject the needed files in your project
- Run “amplify add api” to add a new API
3. Push your changes to the cloud using “amplify push”
Magically, this will build your schema, resolvers, and database tables:
Tables out of the Types
And now you can add an Employee using Mutation, which was added automatically by AWS.
Also, as you can see in the above image, the documentation was created automatically for you, … Amazing :)
Now you can go to the database and check the new Employee
Published by
SENIOR MANAGER SOFTWARE ENGINEER, AWS SOLUTIONS ARCHITECT CERTIFIED®, PSM®, ACSA® , MIS® , UPE®, MSCA®
References: