使用 lambda boto3 描述监听器规则计数
我只是在 Lambda 函数和长度函数上使用下面的代码来计算监听器规则。然而,即使 ALB 有超过 20 条规则,它也始终返回值 2。
import json
import boto3
def lambda_handler(event, context):
client = boto3.client('elbv2')
response1 = client.describe_listeners(
ListenerArns=[
'arn:aws:elasticloadbalancing:eu-west-2:account_id:listener/app/my_load_balancer_listener',
],
)
tot = len(response1)
return response1
得到这样的输出。
Response as 2
I just used below code on Lambda function and length function to calculate listner rules. However it always return the value as 2 even ALB has more than 20 rules.
import json
import boto3
def lambda_handler(event, context):
client = boto3.client('elbv2')
response1 = client.describe_listeners(
ListenerArns=[
'arn:aws:elasticloadbalancing:eu-west-2:account_id:listener/app/my_load_balancer_listener',
],
)
tot = len(response1)
return response1
Get the output like this.
Response as 2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
获取规则,您应该使用 描述规则:
The get the rules, you should use describe_rules: