- Newest
- Most votes
- Most comments
What you can do is setup a sidecar container along side your UDP container that supplies the TCP endpoint for health checks.
The side car would check the service is running on the main ECS task and this would be the Health Check container.
I think this issue you are facing is in the pipeline but do not quote me on it. https://github.com/aws/copilot-cli/pull/4980
Hello. In Amazon Elastic Container Service (ECS), dynamic port mapping is indeed a bit different from Docker Compose and may not allow you to map both UDP and TCP ports to the same dynamic port number for the same container. This limitation arises from how ECS handles dynamic port mapping.
When you define port mappings in your ECS task definition, you can specify the container port, but the host port is assigned dynamically by ECS. ECS ensures that there are no conflicts by assigning unique host port numbers to each container in the task. However, this approach may result in different host port numbers for UDP and TCP protocols for the same container.
Best regards, ANdrii
Relevant content
- asked a year ago
- asked 9 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 days ago
- AWS OFFICIALUpdated 2 years ago
The side car does need a port mapping for the ELB to call the healthcheck ebndpoint and determine the target is healthy. Actually I tested that first (run 2 containers for the same task definition), but port mapping configures 2 different ports (again, 32770 and 32771). And on target group, the task only shows 32770 as traffic port. And traffic port is the only port that ELB knows for calling healthcheck (I mean, i cannot put the UDP port fixed because I would not be able to run multiple tasks in the same instance)
Yeah your right.. this is not possible at this time