Add a listener rule for your Application Load Balancer - Elastic Load Balancing

Add a listener rule for your Application Load Balancer

You define a default rule when you create a listener. You can define additional rules at any time.

To add a rule using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, choose Load Balancers.

  3. Select the load balancer.

  4. On the Listeners and rules tabs, select the text in the Protocol:Port column to open the detail pages for the listener.

  5. On the Rules tab, choose Add rule.

  6. (Optional) To specify a name for your rule, expand Name and tags and enter the name. To add additional tags, choose Add additional tags.

  7. For each condition, choose Add condition, choose the condition type, and provide the required condition values:

    • Host header – Enter the host header. For example: *.example.com.

      Maximum 128 characters. Not case sensitive. Allowed characters are a-z, A-Z, 0-9; the following special characters: -_.; and wildcards (* and ?). You must include at least one "." character. You can include only alphabetical characters after the final "." character.

    • Path – Enter the path. For example: /item/*.

      Maximum 128 characters. Case sensitive. Allowed characters are a-z, A-Z, 0-9; the following special characters: _-.$/~"'@:+; &; and wildcards (* and ?).

    • Query string – Enter key:value pairs, or values without keys.

      Maximum 128 characters. Not case sensitive. Allowed characters are a-z, A-Z, 0-9; the following special characters: _-.$/~"'@:+&()!,;=; and wildcards (* and ?).

    • HTTP request method – Enter the HTTP request method.

      Maximum 40 characters. Case sensitive. Allowed characters are A-Z, and the following special characters: -_. Wildcards are not supported.

    • HTTP header – Enter the name of the header and add one or more comparison strings.

      • HTTP header name – Rule will assess requests containing this header to confirm matching values.

        Maximum 40 characters. Not case sensitive. Allowed characters are a-z, A-Z, 0-9, and the following special characters: *?-!#$%&'+.^_`|~. Wildcards are not supported.

      • HTTP header value – Enter strings to compare against the HTTP header value.

        Maximum 128 characters. Not case sensitive. Allowed characters are a-z, A-Z, 0-9; spaces; the following special characters: !"#$%&'()+,./:;<=>@[]^_`{|}~-; and wildcards (* and ?).

    • Source IP – Define the source IP address in CIDR format.

      Both IPv4 and IPv6 CIDRs are allowed. Wildcards are not supported.

  8. (Optional) To add an authentication rule, select Authenticate users chose an identity provider, and provide the required information. For more information, see Authenticate users using an Application Load Balancer.

  9. For Routing action, select one of the following routing actions and provide the required information:

    • Forward to target groups – Choose a target group. To add another target group, choose Add target group, choose a target group, review the relative percentages, and update the weights as needed. You must enable group-level stickiness if you enabled stickiness on any of the target groups.

    • Redirect to URL – Enter the URL by entering each part separately on the URI parts tab, or by entering the full address on the Full URL tab. For Status code, select either temporary (HTTP 302) or permanent (HTTP 301) based on your needs.

    • Return fixed response – Enter the Response code to return for dropped client requests. Optionally, you can specify the Content type and a Response body.

  10. Choose Next.

  11. For Priority, enter a value from 1-50,000. Rules are evaluated in priority order from the lowest value to the highest value.

  12. Choose Next.

  13. On the Review and create page, choose Create.

To add a rule using the AWS CLI

Use the create-rule command to create the rule. Use the describe-rules command to view information about the rule.