You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ruby AWS SDK中ElasticLoadBalancingV2 describe_load_balancers无返回结果

问题:ElasticLoadBalancing V2 API返回0个负载均衡器,V1却能正常返回全部9个

我最近遇到了一个AWS SDK的问题:原本用ElasticLoadBalancing V1 API的时候,能正常获取到账号里的9个负载均衡器,但因为V1不返回ARN字段,我打算切换到V2版本,结果调用V2的describe_load_balancers却返回了0个结果。我确认账号里确实存在这9个负载均衡器,使用的SDK版本是aws-sdk-core-2.10.90。

下面是我测试用的代码片段:

# V1 客户端调用
client = Aws::ElasticLoadBalancing::Client.new(region: "us-east-1")
resp = client.describe_load_balancers
puts("V1: Number of load balancers returned: #{resp.load_balancer_descriptions.length}")
# 输出:9

# V2 客户端调用
client = Aws::ElasticLoadBalancingV2::Client.new(region: "us-east-1")
resp = client.describe_load_balancers
puts("V2: Number of load balancers returned: #{resp.load_balancers.length}")
# 输出:0

更新:感谢John的解答,这个问题在Ruby SDK的官方文档里没有提到,但在AWS主服务文档页面中有相关说明。

内容的提问来源于stack exchange,提问作者bclarkreston

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:50:32