Skip to content

What's the source IP address of the traffic that Elastic Load Balancing sends to my web servers?

2 minute read
2

I want to know the IP address that my load balancer uses to forward traffic when I use Elastic Load Balancing (ELB) for my web servers.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Use the AWS Management Console or the AWS CLI to get your IP addresses that ELB uses.

Note: The IP addresses for Classic Load Balancers and Application Load Balancers change over time. Don't configure your applications to statically point to these IP addresses.

AWS Management Console

To get your IP addresses from the console, complete the following steps:

  1. Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
  2. In the navigation pane, under Load Balancing, choose Load Balancers.
  3. Under Load balancers, note the name of the load balancer that you want to find the IP addresses for.
  4. In the navigation pane, under Network & Security, choose Network Interfaces.
  5. Enter the load balancer name that you copied into the search box.
  6. Find the primary private IP address of each elastic network interface in the Primary private IPv4 IP column.
    Note: The filtered results show all elastic network interfaces that are associated with the load balancer.

AWS CLI

  1. For Application Load Balancers and Network Load Balancers, run the describe-load-balancers AWS CLI command to find the load-balancer-id:

    aws elbv2 describe-load-balancers --names load-balancer-name --query 'LoadBalancers[].LoadBalancerArn' --output text 

    Example output:

    arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/ALB-external/6961xxxxc843

    Note: The load-balancer-id is the last field of characters that follows the trailing slash after the load balancer's name in the ARN.

  2. Run the describe-network-interfaces AWS CLI command to get the IP address:

    aws ec2 describe-network-interfaces --filters Name=description,Values="ELB elb-name" --query 'NetworkInterfaces[*].PrivateIpAddresses[*].PrivateIpAddress' --output text

    Note: Replace elb-name with one of the following options:
    For Classic Load Balancers, replace with the name of your load balancer.
    For Application Load Balancer, replace with app/load-balancer-name/load-balancer-id. 
    For Network Load Balancers, replace with net/load-balancer-name/load-balancer-id.
    Example output:

    10.0.1.251 10.0.0.208
AWS OFFICIALUpdated 7 months ago
6 Comments

I can see 3 network interfaces. That means, I've 3 public IP addresses?

replied 3 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 3 years ago

My ALB has no addresses in

aws elbv2 describe-load-balancers --names load-balancer-name

But it has several network interfaces. So this provided last command doesn't work as expected

replied 3 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 3 years ago

Hello,

Thank you for this article. I tried the below command and I received 0 IPs associated with my ALB.

Is this normal?

aws ec2 describe-network-interfaces --filters Name=description,Values="ELB elb-name" --query 'NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress' --output text

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 2 years ago