Microservices is an architectural approach towards software development that accelerates software delivery cycles and improves maintainability and scalability of the software. In microservices architecture, software products consist of multiple independent modules or services that can be made to interact via API.

One of the most important aspects of microservices architecture is dynamic and robust services that can respond to failures and frequent changes in load. In modern architectures, services develop their own dependencies to maintain a loosely coupled approach. However, this becomes complicated in a dynamic container environment because each service needs to find the connection address of the target service.

The concept of service discovery solves the problem of communication among the various services in microservices architecture. Service discovery includes service health checks and automatic discovery of new services. Traditional service discovery solutions such as Consul, Etcd or Zookeeper solve this problem if an agent is installed in containers or the services are already preconfigured. Earlier, to ensure that the independent services were discovered and connected, one had to run their own service discovery system or connect each service to a load balancer. Now, one can enable service discovery for containerized services in the Amazon ECS (Elastic Container Service) console or Amazon ECS API.

Amazon ECS uses Amazon Route 53 Auto Naming API to create and manage the service name registry. The name is automatically mapped to a set of DNS records so that one can use the alias to refer to the service and automatically resolve the alias to the endpoint where the service is running. One can specify health check conditions in the Amazon ECS service’s task definition and Amazon ECS will return only normal service endpoints through the service lookup

Service Discovery concepts:

  • Service discovery namespace: It is a logical group of services that share the same domain name. Each Route 53 hosted area and each VPC requires a namespace. If service discovery from the Amazon ECS console is used, then a private namespace for each ECS cluster is created.
  • Service discovery service: It is present in the service discovery namespace consisting of the namespace’s service name and DNS configuration. It provides the following core component:
    • Service Directory: It allows one to find services through Amazon Route 53 Auto Naming API or the DNS and obtain one or more available endpoints that can be used to connect to the service.
  • Health Check: ECS container health checks are performed on a regular basis. If an endpoint fails the health check then it is removed from the DNS routing.

The Route 53 is updated whenever there is an up or down scaling of services so that other services can make connections based on each service’s state. The Route53 service discovery APIs can be used to list all the available services.

Amazon ECS service discovery is available for use in all major Amazon regions such as North Virginia, Ohio, Oregon and Ireland. When using the service discovery feature of Amazon ECS, one gets charged for the amount of Route 53 resources used and the number of lookup queries performed by the service. Service health checks do not incur additional costs.

The major advantage of using Amazon ECS service discovery along with Amazon Route53 is that one doesn’t need to configure or maintain a separate service discovery tool or solution, thus saving operational time. It helps to focus more on the development of independent modules or services rather than registering and de-registering new services in the service discovery tool and testing their connectivity.

Share
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...


Posted by Abhishek Nanda

Leave a reply

Your email address will not be published. Required fields are marked *