Event represents the event or trigger that caused the invocation of the lambda. For example, if your lambda is triggered by an upload to S3 this will contain information about the object being uploaded for example:

    {
      "Records": [
        {
          "eventVersion": "2.0",
          "eventTime": "1970-01-01T00:00:00.000Z",
          "requestParameters": {
            "sourceIPAddress": "127.0.0.1"
          },
          "s3": {
            "configurationId": "testConfigRule",
            "object": {
              "eTag": "0123456789abcdef0123456789abcdef",
              "sequencer": "0A1B2C3D4E5F678901",
              "key": "HappyFace.jpg",
              "size": 1024
            },
            "bucket": {
              "arn": bucketarn,
              "name": "sourcebucket",
              "ownerIdentity": {
                "principalId": "EXAMPLE"
              }
            },
            "s3SchemaVersion": "1.0"
          },
          "responseElements": {
            "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH",
            "x-amz-request-id": "EXAMPLE123456789"
          },
          "awsRegion": "us-east-1",
          "eventName": "ObjectCreated:Put",
          "userIdentity": {
            "principalId": "EXAMPLE"
          },
          "eventSource": "aws:s3"
        }
      ]
    }

Here is detailed information about events, with an example.

Context Provides information about the invocation, function, and execution environment of your lambda. So you can use this to check the memory allocation or to retrieve the number of milliseconds left before the execution times out. Here is detailed documentation about context, with an example.

Answer from Jarred Olson on Stack Overflow
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › define lambda function handler in python
Define Lambda function handler in Python - AWS Lambda
January 31, 2026 - For example, the following code snippet assigns the value of the aws_request_id property (the identifier for the invocation request) to a variable named request. ... To learn more about using the Lambda context object, and to see a complete list of the available methods and properties, see Using the Lambda context object to retrieve Python function information. When defining your handler function in Python, the function must take two arguments. The first of these arguments is the Lambda event object and the second one is the Lambda context object.
Top answer
1 of 3
30

Event represents the event or trigger that caused the invocation of the lambda. For example, if your lambda is triggered by an upload to S3 this will contain information about the object being uploaded for example:

    {
      "Records": [
        {
          "eventVersion": "2.0",
          "eventTime": "1970-01-01T00:00:00.000Z",
          "requestParameters": {
            "sourceIPAddress": "127.0.0.1"
          },
          "s3": {
            "configurationId": "testConfigRule",
            "object": {
              "eTag": "0123456789abcdef0123456789abcdef",
              "sequencer": "0A1B2C3D4E5F678901",
              "key": "HappyFace.jpg",
              "size": 1024
            },
            "bucket": {
              "arn": bucketarn,
              "name": "sourcebucket",
              "ownerIdentity": {
                "principalId": "EXAMPLE"
              }
            },
            "s3SchemaVersion": "1.0"
          },
          "responseElements": {
            "x-amz-id-2": "EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH",
            "x-amz-request-id": "EXAMPLE123456789"
          },
          "awsRegion": "us-east-1",
          "eventName": "ObjectCreated:Put",
          "userIdentity": {
            "principalId": "EXAMPLE"
          },
          "eventSource": "aws:s3"
        }
      ]
    }

Here is detailed information about events, with an example.

Context Provides information about the invocation, function, and execution environment of your lambda. So you can use this to check the memory allocation or to retrieve the number of milliseconds left before the execution times out. Here is detailed documentation about context, with an example.

2 of 3
3

From the docs

When Lambda runs your function, it passes a context object to the handler. This object provides methods and properties that provide information about the invocation, function, and execution environment.

Event (and the args) are described here.

To put it more simply, think of event as an input to a regular function. Context is an extra input supplied by AWS to give you a variety of meta context and such.

Discussions

What fields/properties do 'event' and 'context' have in a Python Lambda invoked by API Gateway?
Assuming you are using a proxy integration the event looks like this: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html#apigateway-example-event The context object: https://docs.aws.amazon.com/lambda/latest/dg/python-context.html More on reddit.com
🌐 r/aws
4
3
February 25, 2022
Nodejs lambda function unable to parse event.body getting errors
Learn directly from AWS solutions architects and EKS specialists through hands-on sessions designed to build your confidence with Kubernetes. Register now and start building with Amazon EKS! ... I followed the below post and created a lambda function with lambda proxy api gateway but i'm getting server error when ever i post data for event... More on repost.aws
🌐 repost.aws
1
0
September 27, 2019
Best way of determining the type of event that was sent to a lambda function?
Why not use a different lambda for each type of event. Boom you get automatic dispatching to the correct implementation. More on reddit.com
🌐 r/aws
20
6
July 31, 2019
Amazon API Gateway -> lambda. Lambda event in blank?
I would recommend not using velocity templates and just use lambda proxy integration. The primary reason one would use the velocity templates is if you want to put API Gateway in front of an existing API and transform between old/new formats More on reddit.com
🌐 r/aws
3
4
August 20, 2017
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › using the lambda context object to retrieve python function information
Using the Lambda context object to retrieve Python function information - AWS Lambda
When Lambda runs your function, it passes a context object to the handler. This object provides methods and properties that provide information about the invocation, function, and execution environment.
🌐
Reddit
reddit.com › r/aws › what fields/properties do 'event' and 'context' have in a python lambda invoked by api gateway?
r/aws on Reddit: What fields/properties do 'event' and 'context' have in a Python Lambda invoked by API Gateway?
February 25, 2022 -

I am writing a Python Lambda that will be invoked via HTTP. A web service will make an HTTP call to an API Gateway resource that I define, which will then invoke the Lambda. My Lambda handler will look like:

def lambda_handler(event, context):
    // do stuff down here
    return responseObject

I am trying to find documentation on event and context so I know how to do things like:

  • extract query string parameters from requests

  • extract path parameters from requests

  • inspect the request entity

  • etc.

Surprising I can find no official AWS documentation on what fields/properties these two objects have on them when they are invoked from an API Gateway resource action. I found this article which was sort of helpful but nothing official from AWS. Can anyone point me in the right direction?

🌐
AWS
docs.aws.amazon.com › cdk › api › v2 › python › aws_cdk.aws_lambda_event_sources › README.html
AWS Lambda Event Sources — AWS Cloud Development Kit 2.238.0 documentation
The eventSourceMappingArn property contains the event source mapping ARN. This will be a token that will resolve to the final value at the time of deployment. Amazon Simple Queue Service (Amazon SQS) allows you to build asynchronous workflows. For more information about Amazon SQS, see Amazon Simple Queue Service. You can configure AWS Lambda to poll for these messages as they arrive and then pass the event to a Lambda function invocation.
🌐
Readthedocs
aws-lambda-for-python-developers.readthedocs.io › en › latest › 02_event_and_context
Chapter 2: What is the event & context? - AWS Lambda for Python Developers
But we'll learn in later chapters how you can provide lambda any number of .py files as your code, and then specify the handler using the following convention: ... Handler functions must always take two arguments, event and context, and they may return a value, in short they always have to look like this:
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › what is aws lambda? › how lambda works › creating event-driven architectures with lambda
Creating event-driven architectures with Lambda - AWS Lambda
AWS services generate events that invoke Lambda functions, and Lambda functions can send messages to AWS services. Generally, the service or resource that invokes a Lambda function should be different to the service or resource that the function outputs to. Failure to manage this can result in infinite loops. For example, a Lambda function writes an object to an Amazon S3 object, which in turn invokes the same Lambda function via a put event.
Find elsewhere
🌐
Dashbird
dashbird.io › home › knowledge base › aws lambda › anatomy of a lambda function
Anatomy Of A Lambda Function | Knowledge Base | Dashbird
January 11, 2021 - Event object is the first argument of the handler function and contains information about the event, for example an API request event holds the HTTP request object. Context object contains information about the invocation, function configuration ...
🌐
Orchestra
getorchestra.io › guides › context-in-aws-lambda
Context in AWS lambda | Orchestra
September 9, 2024 - Within the Lambda function, you can use the context object to gather function execution data, such as remaining time or request ID. This is useful for optimizing performance and handling error scenarios, especially when you need to log details ...
🌐
GeeksforGeeks
geeksforgeeks.org › cloud computing › lambda-function-handler-in-python
Lambda Function Handler In Python - GeeksforGeeks
July 23, 2025 - An event is generally a JSON Formatted String that contains the data that was passed by the external sources when invoking a Lambda function. It is usually of the 'dict' type in python but it can also be other types, such as 'list', 'int', 'float', ...
🌐
Learning-Ocean
learning-ocean.com › tutorials › aws › mastering-aws-lambda-event-objects
Aws - AWS Lambda: Event Objects - Learning-Ocean
When you trigger a Lambda function using a Function URL, an event object is passed to the function. The contents of the event object vary depending on the trigger source: S3 Trigger: Contains details about the newly created S3 object.
🌐
Learning-Ocean
learning-ocean.com › tutorials › aws › aws-lambda-context-object
Aws - Context Object in AWS Lambda - Learning-Ocean
When creating a Lambda function, you typically see two parameters: event and context. While the event object contains information about the triggering event (e.g., API Gateway request, S3 event), the context object provides details about the ...
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with node.js › define lambda function handler in node.js
Define Lambda function handler in Node.js - AWS Lambda
The handler accepts the following arguments: event: Contains the input data passed to your function. context: Contains information about the invocation, function, and execution environment. For more information, see Using the Lambda context object to retrieve Node.js function information.
🌐
AWS Cloud Community
docs.powertools.aws.dev › lambda › python › latest › utilities › data_classes
Event Source Data Classes - Powertools for AWS Lambda (Python)
Each event source is linked to its corresponding GitHub file with the full set of properties, methods, and docstrings specific to each event type. ... The examples showcase a subset of Event Source Data Classes capabilities - for comprehensive details, leverage your IDE's autocompletion, refer to type hints and docstrings, and explore the full API reference for complete property listings of each event source. It is used for Active MQ payloads, also see the AWS blog post for more details.
🌐
AWS
docs.aws.amazon.com › amazon cloudfront › developer guide › customize at the edge with functions › customize at the edge with lambda@edge › lambda@edge event structure
Lambda@Edge event structure - Amazon CloudFront
In this example, Lambda@Edge automatically inserts "key": "User-Agent". For information about restrictions on header usage, see Restrictions on edge functions. ... The HTTP method of the request. ... The query string, if any, in the request. If the request doesn't include a query string, the event object still includes querystring with an empty value.
🌐
GitHub
gist.github.com › jeshan › 52cb021fd20d871c56ad5ce6d2654d7b
AWS Lambda: Determine Event Source from event object. Note that this is an approximation as anybody can send a payload that resembles the real thing. · GitHub
This is probably not the best idea as it relies on AWS implementation details which may change. ... Interesting and useful. I have struggled with the best approach to knowing my invoker. Although this may not persist well over time it is better than putting a caller flag in the payload. The only other option I see is multiple similar functions, which leads to logic sprawl but avoids the conditional overhead. ... elif 'Records' in event and len(event['Records']) > 0 and 'eventSource' in event['Records'][0] and event['Records'][0]['eventSource'] == 'aws:sqs': return 'sqs'
🌐
AWS re:Post
repost.aws › questions › QUL9smr9TtRJG5dDA3R3PjFA › nodejs-lambda-function-unable-to-parse-event-body-getting-errors
Nodejs lambda function unable to parse event.body getting errors | AWS re:Post
September 27, 2019 - 'use strict'; console.log('Loading hello world function'); exports.handler = async (event) => { let name = "you"; let city = 'World'; let time = 'day'; let day = ''; let responseCode = 200; console.log("request: " + JSON.stringify(event)); if (event.queryStringParameters && event.queryStringParameters.name) { console.log("Received name: " + event.queryStringParameters.name); name = event.queryStringParameters.name; } if (event.queryStringParameters && event.queryStringParameters.city) { console.log("Received city: " + event.queryStringParameters.city); city = event.queryStringParameters.city;
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with java › define lambda function handler in java
Define Lambda function handler in Java - AWS Lambda
The runtime deserializes it into an object of the specified type or interface. InputStream – The event is any JSON type. The runtime passes a byte stream of the document to the handler without modification. You deserialize the input and write output to an output stream. Library type – For events sent by other AWS services, use the types in the aws-lambda-java-events