-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS::ECS::Service needs DependsOn AWS::ElasticLoadBalancingV2::ListenerRule #1160
Comments
Edit: ah no, you're right. |
When ALB listener rules are used, the ordering dependency for services that require an attachment to a Load Balancer has to be on the `AWS::ElasticLoadBalancingV2::ListenerRule` object, not on the `Listener` object (as the current implementation does). Fixes #1160.
When ALB listener rules are used, the ordering dependency for services that require an attachment to a Load Balancer has to be on the `AWS::ElasticLoadBalancingV2::ListenerRule` object, not on the `Listener` object (as the current implementation does). Fixes #1160. BREAKING CHANGE: `targetGroup.listenerDependency()` has been renamed to `targetGroup.loadBalancerDependency()`.
Not sure if it will be seen here, but I don't understand why the service would have to depend on any of the other declared resources (load balancer, listener, target group). Surely the service can exist independently of any of these other resources, and rather should be a dependency of the other resources? I'm bringing this up because I want to conditionally create a load balancer and target group containing a service that will always exist, but CloudFormation cannot construct the service when the load balancer isn't created because the service depends on the load balancer listener. When I don't add the load balancer and target group ever (i.e. don't declare them at all), the service can be created just fine. |
I am not sure why this is needed either. The NLB or ALB and ECS Service should be allowed to create in parallel. The target group evaluates LB health checks correct? Only the Target group should be waiting on creation of the ECS Service and LB? |
At the time I opened this issue the Amazon ECS service attempted to
communicate with the load balancer and target group as part of the service
setup process therefore the load balancer and target group must already
exist prior to the service being created.
Years later we added the ability for an ECS service to start out with no LB
or target group and add one later. However, in terms of CloudFormation it
would still be better to just procreate the dependency resources and create
the ECS service once rather than creating the service and then updating it
to use the LB and target group
…On Fri, Feb 14, 2025 at 1:57 PM Daniel Caruso II ***@***.***> wrote:
I am not sure why this is needed either.
The NLB or ALB and ECS Service should be allowed to create in parallel.
The target group evaluates LB health checks correct?
Only the Target group should be waiting on creation of the ECS Service and
LB?
—
Reply to this email directly, view it on GitHub
<#1160 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2VN6RBPGRXPKCGVJUSZ6L2PY4A3AVCNFSM6AAAAABMUDOC2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRQGA2TGNRWGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: dcaruso-pathpoint]*dcaruso-pathpoint* left a comment
(aws/aws-cdk#1160)
<#1160 (comment)>
I am not sure why this is needed either.
The NLB or ALB and ECS Service should be allowed to create in parallel.
The target group evaluates LB health checks correct?
Only the Target group should be waiting on creation of the ECS Service and
LB?
—
Reply to this email directly, view it on GitHub
<#1160 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2VN6RBPGRXPKCGVJUSZ6L2PY4A3AVCNFSM6AAAAABMUDOC2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRQGA2TGNRWGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
When creating a service and adding it to a load balancer the CloudFormation template fails to deploy with the above error. Example code:
This is probably happening because the
AWS::ECS::Service
resource needs aDependsOn
to theAWS::ElasticLoadBalancingV2::ListenerRule
resource. Otherwise it is a race condition that causes a failure if the service resource creation starts before the listener rule is ready.The text was updated successfully, but these errors were encountered: