Implement custom service discovery for Amazon ECS Anywhere tasks
Blog
This article demonstrates implementing custom service discovery for Amazon ECS Anywhere tasks using AWS services to automatically register/deregister container targets with load balancers.
- Amazon ECS Anywhere lacks native load balancing and service discovery support
- Solution uses EventBridge to capture ECS Task State Change events
- AWS Lambda processes events and updates ALB target groups with container IP/port
- Architecture includes on-premises VPC with ECS Anywhere agents and Squid HTTP proxy
- Lambda retrieves host IP via SSM and registers targets through VPC endpoints
- Solution supports scaling: tasks automatically added/removed from ALB targets
- Adaptable for on-premises load balancers via custom Lambda function implementation
- Includes three CloudFormation templates for complete infrastructure provisioning
This approach enables dynamic service discovery for ECS Anywhere workloads by automating target registration based on task state changes, eliminating manual load balancer updates.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
Related articles
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.