使用Boto3描述侦听器规则计数



我需要列出侦听器规则计数,但我仍然得到了null的输出,没有任何错误。当在弹性负载均衡器上创建侦听器规则时,我的整个项目收到了电子邮件通知。

import json
import boto3
def lambda_handler(event, context):
client = boto3.client('elbv2')
response = client.describe_listeners(
ListenerArns=[
'arn:aws:elasticloadbalancing:ap-south-1:my_alb_listener',
],
)
print('response')

这是我的代码的输出

响应空

Response为null,因为您的缩进不正确,并且您没有从处理程序返回任何内容。应该是:

import json
import boto3
def lambda_handler(event, context):
client = boto3.client('elbv2')
response = client.describe_listeners(
ListenerArns=[
'arn:aws:elasticloadbalancing:ap-south-1:my_alb_listener',
],
)
return response

最新更新