Categories
aws

How to View AWS Lambda Event Data?

Wondering how to actually view the event data your lamba function received?
In this post I propose a solution

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.