How can I send http request between ECS services by using App Mesh and Cloud Map

1.4k views Asked by At

What I try to do

What I can't do

  • When the app-gateway sends http request to app-backend, it says 'ENOTFOUND'. (DNS lookup failure?)

Details

  • I have two minimum apps (app-gateway and app-backend. written in Node.js) on ECS under the same VPC. They are running well independently.
    • Envoy proxies are injected by ECS console with default configuration.
  • I defined an App Mesh which has a router to the backend service.
  • AWS Cloud Map is created by ECS. It seems the instances are correctly registered on each service.
  • I use 3000 as a listen port for every definitions except ALB. (It uses 80.)

Architecture

ECS

  • mymesh (ECS cluster)
    • app-gateway (ECS service. The task definition is injected by envoy proxy.)
    • app-backend (ECS service. The task definition is injected by envoy proxy.)

AWS App Mesh

  • app-backend.mymesh.local (Virtual service. provider=app-backend (Virtual router))
  • app-gateway.mymesh.local (Virtual service. provider=app-gateway (Virtual node))
  • app-backend (Virtual router. It has a route to the app-backend (Virtual node).)
  • app-backend (Virtual node. service discovery=AWS Cloud Map, namespace=mymesh.local, service name=app-backend)
  • app-gateway (Virtual node. service discovery=AWS Cloud Map, namespace=mymesh.local, service name=app-gateway, backend=app-backend.mymesh.local)

AWS Cloud Map

  • mymesh.local (Namespace)
    • app-backend (Service. It has a instance registered by ECS)
    • app-gateway (Service. It has a instance registered by ECS)

Route 53

  • mymesh.local (Private host zone. It's assciated with the VPC. It's created when I defined first service on ECS.)
    • app-backend.mymesh.local (A record. The value is the IP address which ECS task is running on.)
    • app-gateway.mymesh.local (A record. The value is the IP address which ECS task is running on.)

ALB

  • app-gateway (A public endpoint to the app-gateway service. It works well.)
    • app-gateway (A target group. The targets are registered by ECS.)

According to this sample app, I thought that I could access to the app-backend via app-backend.mymesh.local like this. But it raises the error.

Please tell me if I should tell more details. (I would tell them by text or screenshots.)

How can I make the http request successfully between ECS services with App Mesh?

1

There are 1 answers

0
Taichiro Suzuki On

I've solved by myself. DNS hostnames configuration must be enabled on my VPC configuration. After enabling it, it works fine. Thanks.