Create an HTTP listener for your Application Load Balancer - Elastic Load Balancing

Create an HTTP listener for your Application Load Balancer

A listener checks for connection requests. You define a listener when you create your load balancer, and you can add listeners to your load balancer at any time.

The information on this page helps you create an HTTP listener for your load balancer. To add an HTTPS listener to your load balancer, see Create an HTTPS listener for your Application Load Balancer.

Prerequisites

  • To add a forward action to the default listener rule, you must specify an available target group. For more information, see Create a target group.

  • You can specify the same target group in multiple listeners, but these listeners must belong to the same load balancer. To use a target group with a load balancer, you must verify that it is not used by a listener for any other load balancer.

Add an HTTP listener

You configure a listener with a protocol and a port for connections from clients to the load balancer, and a target group for the default listener rule. For more information, see Listener configuration.

New EC2 experience
To add an HTTP listener 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 tab, choose Add listener.

  5. For Protocol : Port, choose HTTP and keep the default port or enter a different port.

  6. For Default actions, choose one of the following:

    • Forward to target groups – Choose one or more target groups to forward traffic to. To add target groups choose Add target group. If using more than one target group, select a weight for each target group and review the associated percentage. You must enable group-level stickiness on a rule, if you’ve enabled stickiness on one or more of the target groups.

    • Redirect to URL – Specify the URL that client requests will be redirected to. This can be done by entering each part separately on the URI parts tab, or by entering the full address on the Full URL tab. For Status code you can configure redirects as either temporary (HTTP 302) or permanent (HTTP 301) based on your needs.

    • Return fixed response – Specify the Response code that will be returned to dropped client requests. Additionally, you can specify the Content type and Response body, but they're not required.

  7. Choose Add.

Old EC2 experience
To add an HTTP listener 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 tab, choose Add listener.

  5. For Protocol : Port, choose HTTP and keep the default port or enter a different port.

  6. For Default actions, do one of the following:

    • Choose Forward and choose a target group.

    • Choose Redirect and provide the URL and status code. For more information, see Redirect actions.

    • Choose Return fixed response and provide a response code, optional identity provider, and optional response body. For more information, see Fixed-response actions.

  7. Choose Add.

  8. (Optional) To define additional listener rules that forward requests based on a path pattern or a hostname, see Add a rule.

To add an HTTP listener using the AWS CLI

Use the create-listener command to create the listener and default rule, and the create-rule command to define additional listener rules.