user11810894
user11810894

Reputation:

How to set the draining timeout for an ALB on AWS

I am looking that these instructions for classic load balancers: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/config-conn-drain.html

I want to run this for our ALBs:

 aws elb modify-load-balancer-attributes --load-balancer-name ikg-api-stage-lb  --load-balancer-attributes '{"ConnectionDraining":{"Enabled":true,"Timeout":300}}'

but when I run that, I get this:

An error occurred (LoadBalancerNotFound) when calling the ModifyLoadBalancerAttributes operation: There is no ACTIVE Load Balancer named 'ikg-api-stage-lb'

probably because that command only works for classic LBs?

Upvotes: 2

Views: 8947

Answers (2)

Colin Moreno Burgess
Colin Moreno Burgess

Reputation: 1602

Just wanted to add what I think is the real reason for the error message returned here. You have to take into account the different kinds of elb that you might be having in order to use one command or another. aws elb is indeed for classic load balancers but the error message looks like to point out that the load balancer you are trying to modify its application, network, or gateway load balancer so as pointed out by Imran you should be using aws elbv2 here in the first place

Upvotes: 2

Imran
Imran

Reputation: 6235

With ALBs, you need to apply this value on Target Groups associated to your ALB so they can set perform connection draining during deregistration process of targets. So it will be something like this.

aws elbv2 modify-target-group-attributes --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 --attributes Key=deregistration_delay.timeout_seconds,Value=600

Reference -

Configure Connection Draining for AWS Load Balancer v2 in CloudFormation https://docs.aws.amazon.com/cli/latest/reference/elbv2/modify-target-group-attributes.html

Upvotes: 3

Related Questions