Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS SES – Listing email identities with AWS Lambda

I’m sending emails to verified identities in AWS SES with ASW Lambda without problems.
Now I’m just trying to list verified identities and getting no response.

Here is my code:

import boto3
from botocore.exceptions import ClientError

def list_identities():
    ses = boto3.client('ses')
    response = ses.list_identities(
      IdentityType = 'EmailAddress',
      MaxItems=10
    )

def lambda_handler(event, context):
    # TODO implement
    print("Listing EMAILS:")
    list_identities()

In function log I see printed Listing email: and nothing else.
Lambda function is invoked in same region as AWS SES.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You don’t return anything from your function.

Try this:

import boto3


def list_identities():
    ses = boto3.client('ses')
    response = ses.list_identities(
        IdentityType='EmailAddress',
        MaxItems=10
    )
    print(response)


def lambda_handler(event, context):
    # TODO implement
    print("Listing EMAILS:")
    list_identities()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading