- Newest
- Most votes
- Most comments
There is no direct "disable" option for Application Load Balancer rules in AWS. However, you have a few options to temporarily disable a rule without deleting it:
-
Modify the rule priority: You can use the AWS CLI to set the rule to a very high priority number (lower precedence) so it won't be matched before other rules. You can use the
set-rule-prioritycommand for this. -
Modify the rule's condition: You can temporarily change the path pattern to something that won't match any actual traffic (like "/never-match-this-path-123456/*") using the
modify-rulecommand:
aws elbv2 modify-rule \
--actions Type=forward,TargetGroupArn=[your-target-group-arn] \
--conditions Field=path-pattern,Values='/never-match-this-path-123456/*' \
--rule-arn [your-rule-arn]
When you're done testing, you can modify the rule again to restore the original path pattern ("/foo/bar/baz").
This approach allows you to effectively disable the rule without deleting it, preserving all its configuration for easy restoration later. The AWS CLI provides this flexibility that isn't available in the console interface.
Sources
Elastic Load Balancing - Version 2 examples using AWS CLI - AWS SDK Code Examples
Use ModifyRule with a CLI - AWS SDK Code Examples
Relevant content
asked 4 years ago
asked 5 years ago
asked 2 years ago
asked 2 years ago
