Use DescribeRules with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribeRules with a CLI

The following code examples show how to use DescribeRules.

CLI
AWS CLI

Example 1: To describe a rule

The following describe-rules example displays details for the specified rule.

aws elbv2 describe-rules \ --rule-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee

Example 2: To describe the rules for a listener

The following describe-rules example displays details for the rules for the specified listener. The output includes the default rule and any other rules that you've added.

aws elbv2 describe-rules \ --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2
  • For API details, see DescribeRules in AWS CLI Command Reference.

PowerShell
Tools for PowerShell

Example 1: This example describes the listener rules for the specified Listener ARN.

Get-ELB2Rule -ListenerArn 'arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/test-alb/3651b4394dd9a24f/66e10e3aaf5b6d9b'

Output:

Actions : {Amazon.ElasticLoadBalancingV2.Model.Action} Conditions : {Amazon.ElasticLoadBalancingV2.Model.RuleCondition} IsDefault : False Priority : 1 RuleArn : arn:aws:elasticloadbalancing:us-east-1:123456789012:listener-rule/app/test-alb/3651b4394dd9a24f/66e10e3aaf5b6d9b/2286fff5055e0f79 Actions : {Amazon.ElasticLoadBalancingV2.Model.Action} Conditions : {Amazon.ElasticLoadBalancingV2.Model.RuleCondition} IsDefault : False Priority : 2 RuleArn : arn:aws:elasticloadbalancing:us-east-1:123456789012:listener-rule/app/test-alb/3651b4394dd9a24f/66e10e3aaf5b6d9b/14e7b036567623ba Actions : {Amazon.ElasticLoadBalancingV2.Model.Action} Conditions : {} IsDefault : True Priority : default RuleArn : arn:aws:elasticloadbalancing:us-east-1:123456789012:listener-rule/app/test-alb/3651b4394dd9a24f/66e10e3aaf5b6d9b/853948cf3aa9b2bf
  • For API details, see DescribeRules in AWS Tools for PowerShell Cmdlet Reference.