user60679
user60679

Reputation: 729

Get ELB name from inside EC2 instance

I want to get the ELB name from inside the EC2 instance.

I can do a aws elb describe-load-balancers but this needs the ELB name as input.

I want do it reverse - I know the EC2 instance details from EC2 metadata and want to find the ELB name so that I can append to a file.

Upvotes: 0

Views: 344

Answers (1)

AGL
AGL

Reputation: 546

The command aws elb describe-load-balancers doesn't need the elb name. It will list all the elbs you have. Then you can parse the output JSON and get which instances are attached to every ELB. I don't know if this is your case, but you can find which elb your instance is attached, and then grab the elb name.

Regards

Upvotes: 2

Related Questions