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 Answer from chrisdubya555 on reddit.com
🌐
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 ...
🌐
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
in the powertools-lambda-python repository on GitHub. The following example shows a handler function that logs context information. import time def lambda_handler(event, context): print("Lambda function ARN:", context.invoked_function_arn) print("CloudWatch log stream name:", context.log_stream_name) print("CloudWatch log group name:", context.log_group_name) print("Lambda Request ID:", context.aws_request_id) print("Lambda function memory limits in MB:", context.memory_limit_in_mb) # We have added a 1 second delay so you can see the time remaining in get_remaining_time_in_millis.
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
September 23, 2022
amazon web services - How to access the event object with python in AWS Lambda? - Stack Overflow
To follow up on this question: Filter CloudWatch Logs to extract Instance ID I think it leaves the question incomplete because it does not say how to access the event object with python. My goal ... More on stackoverflow.com
🌐 stackoverflow.com
[deleted by user]
the answer is "historical reasons". but actually the value of a unified structure is unclear. why would you call the same lambda on different events? More on reddit.com
🌐 r/aws
28
17
December 22, 2022
amazon web services - Navigating Event in AWS Lambda Python - Stack Overflow
So I'm fairly new to both AWS and Python. I'm on a uni assignment and have hit a road block. I'm uploading data to AWS S3, this information is being sent to an SQS Queue and passed into AWS Lambda. I More on stackoverflow.com
🌐 stackoverflow.com
🌐
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
In real-life, the event can come from whatever triggers the lambda, a good example, if the lambda were triggered from an HTTP api call via API Gateway, then the event object would look something like this:
🌐
AWS
docs.aws.amazon.com › powertools › python › latest › utilities › data_classes
Event Source Data Classes - Powertools for AWS Lambda (Python)
This example is based on the AWS Cognito docs for Verify Auth Challenge Response Lambda Trigger. app.pyCognito Verify Auth Challengen Example Event · The example integrates with Amazon Connect by handling contact flow events. The function converts the event into a ConnectContactFlowEvent object, providing a structured representation of the contact flow data.
🌐
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?
September 23, 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?

🌐
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', ...
Find elsewhere
🌐
PyPI
pypi.org › project › aws-lambda-event-handler
aws-lambda-event-handler · PyPI
This package provides a decorator for Python Lambda functions handling individual records in the event payload of the AWS Lambda function. ... The following demonstrates how to create a handler object that will be used as the entrypoint for various event sources that trigger a AWS Lambda invokation:
      » pip install aws-lambda-event-handler
    
Published   Aug 25, 2018
Version   0.0.3
🌐
CloudThat
cloudthat.com › home › blogs › understanding aws lambda event sources in python
Understanding AWS Lambda Event Sources in Python
February 9, 2026 - In AWS CDK (Python), the aws_lambda_event_sources library gives you pre-built classes for common AWS services. ... Let’s you connect AWS services (like Amazon SQS, Amazon S3, Amazon DynamoDB, Amazon SNS, Amazon Kinesis, Kafka) to AWS Lambda · Works with the high-level function.add_event_source() API ... SqsEventSource – Create an Amazon SQS queue as a trigger for AWS Lambda. S3EventSource – Use an Amazon S3 bucket’s object upload and removal events.
🌐
Reddit
reddit.com › r/aws › [deleted by user]
Trying to better understand Lambda event objects (Python)
December 22, 2022 - Was it an async invocation that needs no response or is api gateway expecting a response object? ... I’ve got a lambda servicing 200,000 requests a month that maps to 1) SQS 2) SNS 3) DynamoDB, all with their own event formats. First thing my lambda does is rip the event open, see what the EventSource is and then pass the event off to a different in-lambda python function for each event source, each of those functions knows how to parse their own events and they all hand back a python object that I then interact with.
🌐
AWS
aws.amazon.com › blogs › devops › unit-testing-aws-lambda-with-python-and-mock-aws-services
Unit Testing AWS Lambda with Python and Mock AWS Services | AWS DevOps & Developer Productivity Blog
March 22, 2023 - This downstream function avoids directly referencing the global context or any AWS resource connections directly. def lambda_handler(event: APIGatewayProxyEvent, context: LambdaContext) -> Dict[str, Any]: global _LAMBDA_DYNAMODB_RESOURCE global _LAMBDA_S3_RESOURCE dynamodb_resource_class = LambdaDynamoDBClass(_LAMBDA_DYNAMODB_RESOURCE) s3_resource_class = LambdaS3Class(_LAMBDA_S3_RESOURCE) return create_letter_in_s3( dynamo_db = dynamodb_resource_class, s3 = s3_resource_class, doc_type = event["pathParameters"]["docType"], cust_id = event["pathParameters"]["customerId"])
🌐
Pydantic
pydantic.dev › articles › lambda-intro
AWS Lambda: Validate event & context data via Pydantic
April 4, 2024 - Practical guide with step-by-step instructions for validating event and context data in AWS Lambda functions using Pydantic
🌐
Readthedocs
aws-lambda-for-python-developers.readthedocs.io › en › latest › 01_console
Chapter 1: From the Console - AWS Lambda for Python Developers
Step 5: Give this test event a name, I randomly chose 'a', and then hit the Create button. We now have a test event. Step 6: You'll now be taken back to the function page -- just hit the test button, and voila(!), you've tested your first lambda function!
🌐
PyPI
pypi.org › project › aws-lambda-event
aws-lambda-event
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Kevinhakanson
kevinhakanson.com › 2022-08-06-refactoring-python-based-aws-lambda-functions-for-testing
Refactoring Python-based AWS Lambda functions for testing | kevinhakanson.com
The Python-based Lambda function ... the first iteration which was not designed for testability. The lambda_handler receives an event object with a string key and optional integer between 1 and 9 (inclusive)....
🌐
AWS
docs.aws.amazon.com › powertools › python › 2.14.0 › utilities › data_classes
Event Source Data Classes - AWS Lambda Powertools for Python
March 20, 2023 - The classes are initialized by passing in the Lambda event object into the constructor of the appropriate data class or by using the event_source decorator. For example, if your Lambda function is being triggered by an API Gateway proxy integration, you can use the APIGatewayProxyEvent class.
🌐
Medium
medium.com › @reach2shristi.81 › starting-your-lambda-journey-with-python-74d95346dd0
Starting your Lambda Journey with Python | by Min_Minu | Medium
June 25, 2023 - Here’s an example of a handler function: def lambda_handler(event, context): ... The event parameter provides the input data to your Lambda function. Extract relevant information from the event object and perform the required processing or logic.
🌐
Stack Overflow
stackoverflow.com › questions › 75220393 › aws-lambda-python-how-to-pass-json-input-to-event-object-in-python-handler
amazon web services - AWS Lambda - Python : How to pass JSON input to event object in python handler - Stack Overflow
Hence we can use event['who'] to fetch the value of the 'who' attribute. def lambda_handler(event, context): return { 'statusCode': 200, 'body': json.dumps('Hello from ' + event['who'] ) }