Home > Net >  Describe listener rule count using Boto3
Describe listener rule count using Boto3

Time:03-29

i need to list listener rules count but still i get a output as null without any error.my complete project was getting email notification from when listener rules created on elastic load balancer.

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')

Here is the output of my code

Response null

CodePudding user response:

Response is null because your indentation is incorrect and you are not returning anything from your handler. It should be:

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
  • Related