raviteja pothula
raviteja pothula

Reputation: 21

service XXX was unable to place a task because no container inst met all of its reqmnts. instance XXX is already using a port required by your task

service crm was unable to place a task because no container instance met all of its requirements. The closest matching container-instance e45856e4821149XXXXXXXXX is already using a port required by your task.

is there any way to resolve this, currently i have trying to run 4 task-definition i have referred below AWS documents not sure which solution will be ideal to resolve current issue ? dynamic porting how to do it ?

registered ports : ["22","4000","2376","2375","51678","51679"]

https://aws.amazon.com/premiumsupport/knowledge-center/dynamic-port-mapping-ecs/ https://aws.amazon.com/premiumsupport/knowledge-center/ecs-container-instance-requirement-error/ https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages.html#service-event-messages-1

tried referring AWS docs for current issue, not sure how to resolve port issue.

Upvotes: 1

Views: 612

Answers (1)

sytech
sytech

Reputation: 40891

If you create port mappings in your task definition, you will occupy the ports on the host. If you do not create port mappings in your task definition (and only specify the container port) you will receive a dynamically allocated port on the host automatically.

So: don't specify the host port in the task definition.

The target group associated with your task can be used to dynamically target the tasks from, say, a load balancer or other resources supporting target groups.

Or you can create more instances in your autoscaling group so that your task can be placed on an instance where the port is not in use. You can use capacity providers to automatically create new instances when needed. Though, this is likely far less efficient than dynamic port mapping, depending on the performance characteristics of your workloads.

Upvotes: 1

Related Questions