Interconnecting services - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Interconnecting services

Applications that run in Amazon ECS tasks often need to receive connections from the internet or to connect to other applications that run in Amazon ECS services. If you need external connections from the internet, we recommend using Elastic Load Balancing. For more information about integrated load balancing, see Service load balancing.

Choosing an interconnection method

If you need an application to connect to other applications that run in Amazon ECS services, Amazon ECS provides the following ways to do this without a load balancer:

  • Amazon ECS Service Connect

    Amazon ECS Service Connect provides management of service-to-service communication as Amazon ECS configuration. It does this by building both service discovery and a service mesh in Amazon ECS. This provides the complete configuration inside each Amazon ECS service that you manage by service deployments, a unified way to refer to your services within namespaces that doesn't depend on the Amazon VPC DNS configuration, and standardized metrics and logs to monitor all of your applications on Amazon ECS. Amazon ECS Service Connect only interconnects Amazon ECS services.

    You must configure any cross-VPC connectivity that you want to use with Amazon ECS Service Connect. There's no additional Amazon VPC or network infrastructure configuration required for service-to-service communication when using Service Connect beyond the cross-VPC connectivity. Service Connect configures each task for your applications to discover services. Service Connect configures DNS names for your services in the task itself, and doesn't require nor create DNS records in your hosted zones.

    For more information, see Service Connect.

  • Amazon ECS service discovery

    Amazon ECS service discovery integrates services with Amazon Cloud Map namespaces to add entries (specifically, Amazon Cloud Map service instances) to the namespace for each task in the Amazon ECS service. To connect, an app resolves these entries as DNS hostname records or uses the Amazon Cloud Map API to get the IP address of the tasks.

    Amazon ECS service discovery can be used with any applications, including UDP connections. Service discovery doesn't affect the connecting protocol or traffic route.

    For more information, see Service discovery

Network mode compatibility table

The following table covers the compatibility between these options and the task network modes. In the table, "client" refers to the application that's making the connections from inside an Amazon ECS task.

Interconnection Options Bridged awsvpc Host
Service discovery yes, but requires clients be aware of SRV records in DNS without hostPort. yes yes, but requires clients be aware of SRV records in DNS without hostPort.
Service Connect yes yes no