3

Given a load balancer name, is it possible to find its ARN with AWS API? The closest I see is the describe_load_balancers function, but its output doesn't include ARN. Am I missing something simple?

Full context: The script adds "DDoSAttackBitsPerSecond" metrics to a AWS Dashboard, and metric description includes the ARN of the load balancer as one of its dimensions.

Any suggestions appreciated,

Mike

PrasadK
  • 778
  • 6
  • 17
Mikey
  • 91
  • 1
  • 7
  • 1
    The ARN is returned for application load balancers, not for classic load balancers. Is generating the ARN dynamically an option for you? If so, the ELB arn looks like this: `arn:aws:elasticloadbalancing:{region}:{account-id}:loadbalancer/{name}`. You know the name and region of the load balancer. To get the account number, invoke the `GetCallerIdentity` API (under sts). – krishna_mee2004 Feb 22 '18 at 20:47
  • I was using boto3.client('elb'), which doesn't return ARN, instead of boto3.client('elbv2'), which does. Thanks for quick response though. – Mikey Feb 22 '18 at 21:04

1 Answers1

4

Doh, I was using boto3.client('elb'), which doesn't return ARN, instead of boto3.client('elbv2'), which does. I hope someone will find this useful...

Mikey
  • 91
  • 1
  • 7