create a task definition called Frontend
inside the tsask definition, add one nginx and two php container
call them nginx, php01, php02
Sadly ECS requires for one of the containers to have the same name has the task definition, which is very limiting
to be able to create a service for this task definition and call it frontend-service
* aws_ecs_service.ecs-service: InvalidParameterException: The container Frontend does not exist in the task definition.
@FernandoMiguel Are you trying to register the service with a load balancer, when registering the service with a load balancer, you need to specify the container name in the load balancer configuration, see the document here. So if you are registering the load balancer with Frontend, which is the task definition name, you will get an error like this, in your case you may want to use nginx instead of Frontend. Let me know if this solves your problem.
Thanks,
Peng
Hi @FernandoMiguel closing this issue for now as @richardpen has answered your question. Please let us know if you have any follow up questions/comments. Thanks!
I know this issue has been closed for a while, but wouldn't it be a good idea to improve this error message mentioning that the load balancer is the one that requires this specific container name?
I agree with @VinGarcia - just a simple change of wording, from:
InvalidParameterException: The container Frontend does not exist in the task definition.
to
InvalidParameterException: The loadbalancer can not find the container Frontend.
load_balancer {
target_group_arn = var.alb_target_group_arn
container_name = "<name_of_one_of_the_containers_in_task_definitions>"
container_port = 3000
}
Hey, is there an actual technical reason for this? It would be useful to know why this is required, somewhat odd.
Most helpful comment
I agree with @VinGarcia - just a simple change of wording, from:
to