Does your business need to innovate faster to remain competitive? To accelerate the pace of innovation, have you implemented modern microservices-based applications running in containerized environments? Do you want to improve the availability of those applications and enhance engineering productivity? If so, this blog is for you.
Microservices are implemented using dynamic resources such as containers and communicating over APIs. The number and network location of instances change dynamically based on service terminations, autoscaling, failures, and upgrades. Each service needs to be able to quickly find the location of all the infrastructure resources on which it depends in order to function. Therefore, application availability depends on efficient service discovery of these dynamically changing resources.
AWS Cloud Map is a fully managed cloud resource discovery service that increases application availability by maintaining the updated location of dynamically changing resources. Application resources – such as databases, queues, microservices, and other cloud resources – are registered with custom names, enabling AWS Cloud Map to continually check the health of resources and ensure locations are up to date.
With this single registry for all your application services, your engineering teams don’t have to manually store, track, and update resource name and location information or make changes directly within the application code.
In the past, have you wanted more control over monitoring services and centralizing multiple applications, beyond what was possible using AWS Application Load Balancer (Amazon ALB)? With Amazon ALB, you can specify only one port for target groups, and Amazon ECS clusters and services. Amazon ALB maps the listener port to a random port in the target group and the target group registers a new container with a random private IP in the Amazon ECS cluster, making it impossible to know where that container is located. In that case the container can only be accessed by the load balancer. What if you need to access an additional port?
Here’s a real-life example of that dilemma, and why AWS Cloud Map is so cool. An nClouds client needed to expose a service, a Jenkins master running as an Amazon Elastic Container Service (Amazon ECS). The Jenkins master was using slave workers inside an AWS ECS cluster for their CI/CD process. In this case, Jenkins slaves could not find the Jenkins master server. Amazon ECS could expose only a single port (8080) and we needed to expose the port for slaves (50000). So, we used AWS Cloud Map not only to find the server where the Jenkins master was located but to also provide access to the extra port.
Below is a comparison of how endpoints are handled without and with AWS Cloud Map. As you can see, with AWS Cloud Map, endpoints are dynamically located, instead of being statically coded into the application.
Source: Amazon Web Services, Inc. Cloud Map – Service discovery for cloud resources.
Important note: When you create a service, you can also choose whether and how you want to check the health of the resources that service instances point to:
Services and tasks managed by Amazon Elastic Container Service (Amazon ECS) or Amazon Elastic Service for Kubernetes (Amazon EKS) can be registered automatically and updated in AWS Cloud Map. As Amazon ECS launches tasks for your service, it automatically registers them as resources with AWS Cloud Map, and they are discoverable within five seconds.
The diagram below shows how we use the service discovery option to access Docker container workers outside a target group port, using a namespace and service to access the container with our worker. Services are built using Amazon Elastic Compute Cloud (Amazon EC2) instances and Amazon ECS tasks. Amazon Route 53 manages the routing queries.
The diagram below shows how we utilize the Amazon EKS cluster as a backend. This backend is connected to a namespace of AWS Cloud Map with the configuration of Kubernetes’ cluster-internal DNS server, ExternalDNS. In this case, the frontend can easily connect with the workers through each service specified in the namespace.
If your business is accelerating the pace of innovation, needs to improve the availability of microservices-based applications running in containerized environments, and wants to enhance engineering productivity, consider using AWS Cloud Map.
Need help with implementing AWS Cloud Map? The nClouds team is here to help with that and all your AWS infrastructure requirements.