Update ECS Load Balancers With No Downtime

Nov. 8, 2020

Services on AWS ECS can have multiple target groups attached to them (and thus load balancers). Can come in handy for things like having public vs private load balancers. Unfortunately, you can’t modify these attachments once your service is created.

If your application can stand it, you could just recreate the service and be done with it. Otherwise, we can look at the relationships between our resources. Just as a service can be attached to multiple target groups, more than one service can attach to a single target group (many to many).

So, one way to work around this is to create a duplicate, temporary copy of your service and run it on the same cluster and attach the same target groups. You should see then double the amount of instances serving your requests, some from service A and from service B.

Then you can recreate service A with the updated config freely. Other combinations would work, such as if you wanted to have service B with the changes to see how that’d work. All works out the same in the end, you’re just ensuring there’s extra instances to serve traffic while recreation is occurring.