73.8k views
4 votes
How are events represented in AWS Lambda?

User Nerdenator
by
7.6k points

1 Answer

3 votes

Final answer:

In AWS Lambda, events are represented as JSON documents that are sent by event sources like Amazon S3 or Amazon DynamoDB to trigger Lambda functions, which then process the event data contained within the JSON.

Step-by-step explanation:

When working with AWS Lambda, events are represented as JSON-formatted documents that trigger a function to execute. These events can come from various sources such as Amazon S3, Amazon DynamoDB, or Amazon API Gateway. Each event source has a specific structure for its JSON document, which contains data relevant to the event that occurred. For example, an S3 event contains information about the S3 bucket and the object that triggered the event. AWS Lambda functions can then use this information to process the event accordingly.

Events are the core starting point for Lambda functions. When an event occurs, AWS Lambda runs the corresponding function asynchronously, passing the event—as a JSON document—as an argument to the function's handler. The handler function in the Lambda code processes the event. For instance, upon receiving an S3 CreateObject event, a Lambda function could be triggered to resize an image or validate the contents of the uploaded file.

User BoltKey
by
7.8k points