Movatterモバイル変換


[0]ホーム

URL:


Invoking Lambda with events from other AWS services - AWS Lambda
DocumentationAWS LambdaDeveloper Guide
Creating a triggerServices list

Invoking Lambda with events from other AWS services

Some AWS services can directly invoke Lambda functions usingtriggers. These services push events to Lambda, and the function is invoked immediately when the specified event occurs. Triggers are suitable for discrete events and real-time processing. When youcreate a trigger using the Lambda console, the console interacts with the corresponding AWS service to configure the event notification on that service. The trigger is actually stored and managed by the service that generates the events, not by Lambda.

The events are data structured in JSON format. The JSON structure varies depending on the service that generates it and the event type, but they all contain the data that the function needs to process the event.

A function can have multiple triggers. Each trigger acts as a client invoking your function independently, and each event that Lambda passes to your function has data from only one trigger. Lambda converts the event document into an object and passes it to your function handler.

Depending on the service, the event-driven invocation can besynchronous orasynchronous.

  • For synchronous invocation, the service that generates the event waits for the response from your function. That service defines the data that the function needs to return in the response. The service controls the error strategy, such as whether to retry on errors.

  • For asynchronous invocation, Lambda queues the event before passing it to your function. When Lambda queues the event, it immediately sends a success response to the service that generated the event. After the function processes the event, Lambda doesn’t return a response to the event-generating service.

Creating a trigger

The easiest way to create a trigger is to use the Lambda console. When you create a trigger using the console, Lambda automatically adds the required permissions to the function'sresource-based policy.

To create a trigger using the Lambda console
  1. Open theFunctions page of the Lambda console.

  2. Select the function you want to create a trigger for.

  3. In theFunction overview pane, chooseAdd trigger.

  4. Select the AWS service you want to invoke your function.

  5. Fill out the options in theTrigger configuration pane and chooseAdd. Depending on the AWS service you choose to invoke your function, the trigger configuration options will be different.

Services that can invoke Lambda functions

The following table lists services that can invoke Lambda functions.

ServiceMethod of invocation

Amazon Managed Streaming for Apache Kafka

Event source mapping

Self-managed Apache Kafka

Event source mapping

Amazon API Gateway

Event-driven; synchronous invocation

AWS CloudFormation

Event-driven; asynchronous invocation

Amazon CloudWatch Logs

Event-driven; asynchronous invocation

AWS CodeCommit

Event-driven; asynchronous invocation

AWS CodePipeline

Event-driven; asynchronous invocation

Amazon Cognito

Event-driven; synchronous invocation

AWS Config

Event-driven; asynchronous invocation

Amazon Connect

Event-driven; synchronous invocation

Amazon DocumentDB

Event source mapping

Amazon DynamoDB

Event source mapping

Elastic Load Balancing (Application Load Balancer)

Event-driven; synchronous invocation

Amazon EventBridge (CloudWatch Events)

Event-driven; asynchronous invocation (event buses), synchronous or asynchronous invocation (pipes and schedules)

AWS IoT

Event-driven; asynchronous invocation

Amazon Kinesis

Event source mapping

Amazon Data Firehose

Event-driven; synchronous invocation

Amazon Lex

Event-driven; synchronous invocation

Amazon MQ

Event source mapping

Amazon Simple Email Service

Event-driven; asynchronous invocation

Amazon Simple Notification Service

Event-driven; asynchronous invocation

Amazon Simple Queue Service

Event source mapping

Amazon Simple Storage Service (Amazon S3)

Event-driven; asynchronous invocation

Amazon Simple Storage Service Batch

Event-driven; synchronous invocation

Secrets Manager

Secret rotation

AWS Step Functions

Event-driven; synchronous or asynchronous invocation

Amazon VPC Lattice

Event-driven; synchronous invocation

Troubleshooting
Apache Kafka

[8]
ページ先頭

©2009-2025 Movatter.jp