Microservices architecture with AWS app mesh and ECS fargate

Akshay K
3 min readNov 22, 2020

--

Below topic explain communication between two micro service i.e user_management and notification with no service discovery and with app mesh service discovery.

Microservices Deployment on AWS ECS — No Service Discovery

Above image shows, without app mesh discovery User management service need to call Notification service via internet using ALB.

Drawbacks of this setup

  • User management service calling notification service via internet using ALB.
  • Both services present in same VPC, same network and sitting next to each other and for communication going over the internet
  • How to fix this?
  • Microservices — Service Discovery concept will be the solution for the same and in our next section we will see how to implement that on AWS Fargate and ECS.

Microservices deployment on ECS AWS service discovery app mesh.

With this approach:

  • We are going to enable the service discovery for Notification Microservice.
  • User Management Microservice will call Notification Service using AWS Cloud Map Namespace.
  • In that way calls from User Management Microservice to Notification Microservice will be internal to VPC via private DNS of service, without via Load balancer route.

AWS ECS Cluster setup with fargate

Below snip shows 2 services each for appmesh-notification and appmesh-usermanagemnt

Snip for running task : In this Farget-demo cluster two running microviserves communication with each other via private DNS name with aws App Mesh feature

Snip for task definition for each service.

While creating service you should see option to give private DNS name to your service as below.

You can use App Mesh with AWS Fargate, Amazon EC2, Amazon ECS, Amazon EKS, and Kubernetes running on AWS, to better run your application at scale.

--

--