Amazon CloudFormation: How to get an ELB's private IP for a specific subnet?

We had same problem, below command I use for getting internal IP of ELB "LAMP-Prod"

aws ec2 describe-network-interfaces --filters "Name=description,Values=ELB LAMP-Prod" |grep -wE 'Description|PrivateIpAddress'

Or using JQ and without the need to specify an ELB name

 aws ec2 describe-network-interfaces --filters Name=requester-id,Values='amazon-elb' | jq -r '.NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress'

If you want to get the private ip address of an elb, check network interfaces under network and security in you ec2 dashboard.


JQ parsing version, just FYI.

aws ec2 describe-network-interfaces --filters "Name=description,Values=ELB your-elb-name" --output json | jq ".NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress"