简体   繁体   中英

aws sdk not listing load balancers

I'm trying to list my load balancers in us-east-1 (US East (N. Virginia)). I can see two load balancers front the web console (under EC2 > Load Balancing > Load Balancers) But if I run:

AWS = require('aws-sdk');
var elb = new AWS.ELBv2({
  accessKeyId: '<accessKeyId>',
  secretAccessKey: '<secretAccessKey>',
  region: 'us-east-1'
});

elb.describeLoadBalancers({}, (e, r) => console.log('error', e, 'result', r))

this logs:

error null result { ResponseMetadata: { RequestId: '<some-long-id>' }, LoadBalancers: [] }

The ELBv2 class in the Javascript SDK is not a replacement for the ELB class. ELBv2 is for 2nd generation ELB -- Application Load Balancers, while ELB is used for 1st generation ELB, now referred to as Classic Load Balancers.

The two generations of ELB do have some overlap in their features and capabilities, but both generations offer capabilities that the other does not -- Classic LB can do SSL/TLS offloading for non-HTTP services, Application LB can't; Application LB can choose back-ends based on HTTP request paths and speak HTTP/2 and route to multiple ports on a single instance, Classic LB can't.

The two generations are very different in their configuration options, and presumably that is why there's a separate interface for interrogating and manipulating two different types of balancers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM