Categories
aws python

How to View AWS Lambda Event Data?

Wondering how to actually view the event data your lamba function received? With python.

In this post a solution is proposed.

Other search phrases:

  • View aws lambda event data
  • aws lambda view event data

Viewing AWS Lambda Event Data

Create a new lambda with the permissions and trigger you need and call it test-debug-<myproblem>

I will show an example with python but port it to the runtime (programming language) you are using. Also make sure you use the built in code editor so you can quickly modify things without having to package stuff up:

import json
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

def lambda_handler(event, context):
    logger.debug('Event data: %s', event)

    return {
        'statusCode': 200,
        'body': 'Hello world'
    }

Then check the cloudwatch log stream and your event data will be written out to the log.