question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to update existing ECS non-loadbalanced service when adding to load balancer

See original GitHub issue

Describe the bug

When there is an existing ECS service which is not initially configured with a load balancer, and a change is made to add this service to a target group for an ALB, the CFN change performed is an UPDATE. However this is not possible since ALB assignment can only be done to an ECS service during creation.

Expected Behavior

In this scenario the change should recreate the service resource rather than update it.

Current Behavior

Update fails with the following message:

Resource handler returned message: "Invalid request provided: UpdateService error: Health check grace period is only valid for services configured to use load balancers (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: xxxyyyzzz; Proxy: null)"

Reproduction Steps

  1. Create a FargateService which is not backed by a load balancer.
  2. Deploy
  3. Add the service from step 1 as a target to an ALB’s listener
  4. Deploy

Possible Solution

Rather than making the change as an update, it should recreate the service resource in order to assign the ALB correctly.

Additional Information/Context

No response

CDK CLI Version

2.20.0 (build 738ef49)

Framework Version

No response

Node.js Version

v17.8.0

OS

Ubuntu 21.10 (5.17.0-051700-generic)

Language

Typescript

Language Version

4.6.2

Other information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:34
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
jaeckteccommented, Apr 29, 2022
(service.node.defaultChild as CfnService).healthCheckGracePeriodSeconds = undefined;

works for me

1reaction
peterwoodworthcommented, Jun 10, 2022

I’m not sure how I ran into the deployment stall after i deleted the health check from my template. Must have been an intermittent issue 😕

We should be able to support adding a load balancer to a service without requiring that users use an escape hatch to remove the property

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting service load balancers - AWS Documentation
Amazon ECS services can register tasks with an Elastic Load Balancing load balancer. Load balancer configuration errors are common causes for stopped tasks....
Read more >
Spinnaker Release 1.14.2
To change this behavior for a specific application, modify the application config in the UI to explicitly add EXECUTE permissions to a group....
Read more >
Updating a service using the new console - 亚马逊云科技
Amazon ECS does not automatically update the security groups associated with Elastic Load Balancing load balancers or Amazon ECS container instances.
Read more >
aws_ecs_service | Resources | hashicorp/aws
Provides an ECS service - effectively a task that is expected to run until an ... (Optional) Seconds to ignore failing load balancer...
Read more >
How to Setup AWS ECS Fargate with a Load Balancer
This is a step by step tutorial where I show you how to set up a basic Python based AWS Fargate App within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found