I have an AWS ALB with a listener configured where default action is to forward traffic in active-active mode : 50% of traffic to a target group (TargetGroupA) and 50% to another target group (TargetGroupB).
To perfom maintenance, I would like to edit this rule using AWS CLI to :
TargetGroupATargetGroupA to 100% on TargetGroupBIt looks like you should use modify-listener.
The --default-actions parameter has a ForwardConfig.TargetGroups.Weight setting that ranges from 0 to 999.
Use weights like 1,0, 1,1 (50% each) and 0,1 to direct traffic to the target groups.
Using the link given by @john-rotenstein, this command worked for me (with aws-cli/1.18.37):
aws elbv2 modify-listener \
--listener-arn "<listener arn>" \
--default-actions \
'[{
"Type": "forward",
"Order": 1,
"ForwardConfig": {
"TargetGroups": [
{"TargetGroupArn": "<target group 1 arn>", "Weight": 1 },
{"TargetGroupArn": "<target group 2 arn>", "Weight": 0 }
]
}
}]'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With