Kubernate

AWS # Service Discovery (R53-ECS-EKS)

 

In AWS, the most common service discovery mechanism is AWS Cloud Map, often integrated with ECS, EKS, or Route 53. It allows services to be registered with DNS names or API endpoints so that other services can discover them dynamically. Configuration typically involves creating a namespace in Cloud Map, registering services, and linking them to ECS/EKS tasks or load balancers.


πŸ”‘ Service Discovery Options in AWS

  • AWS Cloud Map
    • Fully managed service registry.
    • Supports both DNS-based discovery and API-based discovery.
    • ECS/EKS services can automatically register themselves with Cloud Map.
    • Eliminates manual IP management.
  • Amazon ECS Service Discovery
    • ECS integrates directly with Cloud Map.
    • You can configure ECS services to automatically register in a Cloud Map namespace.
    • Other ECS tasks or external clients can resolve service names via DNS.
  • Amazon Route 53
    • Often used for DNS-based service discovery.
    • Can be combined with Cloud Map or Application Load Balancer (ALB).
    • Useful when you want human-readable DNS names for services.

Sources:


⚙️ How It’s Configured (Typical ECS Example)

  1. Create a Namespace in Cloud Map
    • Example: orders.local (private DNS namespace).
    • This namespace will hold service records.
  2. Register Services
    • When defining an ECS service, enable service discovery.
    • ECS will automatically register the service in Cloud Map with a DNS name like orders.orders.local.
  3. Configure Tasks
    • Each ECS task gets registered with the service name.
    • Other services can resolve orders.orders.local to reach the task.
  4. Consumer Side
    • Applications simply call the DNS name.
    • Cloud Map resolves it to the right IP or endpoint.

πŸ“Š Example Flow

  • You deploy a Payment Service in ECS.
  • Configure ECS service discovery → registers payment.orders.local in Cloud Map.
  • Your Order Service calls http://payment.orders.local:8080 instead of hardcoding IPs.
  • Cloud Map resolves the DNS name to the running ECS task(s).
  • If tasks scale up/down, Cloud Map updates automatically.

Best Practices

  • Use Cloud Map namespaces for logical grouping (e.g., dev.local, prod.local).
  • Prefer DNS-based discovery for simplicity; use API-based discovery when you need metadata.
  • Combine with ALB/NLB for load balancing across tasks.
  • For EKS (Kubernetes), service discovery is usually handled by CoreDNS, but you can integrate Cloud Map for cross-service discovery.

πŸ‘‰ In short: AWS Cloud Map + ECS/EKS integration is the standard service discovery approach. It’s configured by creating a namespace, registering services, and letting ECS/EKS auto-register tasks. Other services then resolve them via DNS, ensuring dynamic and sequential communication without manual IP management.


 

No comments:

Post a Comment

Spring Boot - Bean LifeCycle

 Here is a clear, step-by-step lifecycle of a Spring Boot application , explained in a simple + interview-ready way. πŸ”„ Spring Boot Applica...

Kubernate