In our upcoming steps, we will deploy the Frontend and Backend applications into separate Amazon ECS Services running on AWS Fargate.
However, because containers can be stopped, restarted, or scaled horizontally across multiple Availability Zones, their private IP addresses change dynamically. If the Frontend hardcodes the Backend’s private IP, any container replacement or scaling event will cause connection failures.
To solve this challenge, AWS provides AWS Cloud Map, a fully managed cloud resource discovery service:
How does Service Discovery work between ECS and Cloud Map? When a namespace is created with API calls and DNS queries in VPCs, AWS Cloud Map automatically provisions an Amazon Route 53 Private Hosted Zone linked to your VPC. When ECS launches a task for your Backend service, it automatically registers the container’s private IP into this DNS record. The Frontend container queries standard VPC DNS (Route 53 Resolver) and receives the current healthy Backend IP.
Always verify the AWS Region in the top-right corner of the AWS Console. Cloud Map namespaces and Route 53 Private Hosted Zones are region-bound to the VPC. If you create the namespace in a different region than your VPC, your ECS tasks won’t be able to discover each other!
Cloud Map and select Cloud Map from the services list.
A Namespace in Cloud Map defines the boundary and domain structure for your microservices (similar to a top-level private domain name).

| Field | Value | Description |
|---|---|---|
| Namespace name | FCAJResbar.internal |
The root domain name for all services within this namespace. |
| Description | Use for internal API Calls and DNS |
An optional description indicating the purpose of this namespace. |
| Instance discovery | API calls and DNS queries in VPCs | Enables standard DNS lookups within your VPC via Route 53 private hosted zones. |

API calls only requires application code to call AWS Cloud Map SDK/APIs to discover IP addresses. API calls and DNS queries in VPCs automatically creates a Route 53 Private Hosted Zone. Applications can use standard HTTP requests like http://backend.FCAJResbar.internal:3000 without any AWS SDK dependencies in the codebase.
Understanding TTL (Time To Live):
TTL dictates how long DNS resolvers inside your VPC cache the DNS response. A low TTL like 20 seconds is ideal for containerized environments because when tasks are replaced or scaled, clients quickly receive the updated IP addresses without waiting for stale cache to expire.


Next, we define a Service within our namespace. A service represents a specific component (such as our Backend API) and defines how its instances are registered and routed.
FCAJResbar.internal, scroll down to the Services section.
| Field | Value | Explanation |
|---|---|---|
| Service name | backend |
The prefix for the service. When combined with the namespace, the FQDN becomes backend.FCAJResbar.internal. |
| Description | Backend Service Discovery Name |
Brief description of the service’s role. |
| Discoverable by | API and DNS | Allows discovery via both DNS queries and Cloud Map API. |

Save the Full Service Discovery Name
With the service name backend and namespace FCAJResbar.internal, the Fully Qualified Domain Name (FQDN) is:
backend.FCAJResbar.internal
Please make a note of this domain name. In Step 6.2 (Frontend Task Definition), we will set the environment variable:
BACKEND_HOST = backend.FCAJResbar.internal
BACKEND_PORT = 3000
300 seconds.
Why select “No health check” in Cloud Map?
Amazon ECS manages its own task health checks (via container health checks and ALB target groups). When integrated with ECS, ECS automatically notifies Cloud Map when a task is healthy or stopped. Therefore, additional Cloud Map-level Route 53 health checks are unnecessary and would incur extra Route 53 health checking charges.

fcajresbar.internal in Route 53 console, we can verify it by going to the Route 53 console and selecting Private Hosted Zones and we should see fcajresbar.internal there.

Let’s review what was configured and how it will be used in subsequent lab modules:
| Component | Configured Value | Usage in Lab |
|---|---|---|
| Namespace | FCAJResbar.internal |
Acts as the private DNS domain inside our VPC. |
| Service | backend |
Registered under the namespace. |
| FQDN | backend.FCAJResbar.internal |
Used in Step 6.2 by Frontend containers to reach the Backend API. |
| Integration | Amazon ECS Service Discovery | In Step 8.1, when creating the Backend ECS service, we will link it to this backend service so tasks automatically register their private IPs here. |