class SnsEventSource
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.EventSources.SnsEventSource |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#SnsEventSource |
Java | software.amazon.awscdk.services.lambda.eventsources.SnsEventSource |
Python | aws_cdk.aws_lambda_event_sources.SnsEventSource |
TypeScript (source) | aws-cdk-lib » aws_lambda_event_sources » SnsEventSource |
Implements
IEvent
Use an Amazon SNS topic as an event source for AWS Lambda.
Example
import * as sns from 'aws-cdk-lib/aws-sns';
import { SnsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
declare const topic: sns.Topic;
const deadLetterQueue = new sqs.Queue(this, 'deadLetterQueue');
declare const fn: lambda.Function;
fn.addEventSource(new SnsEventSource(topic, {
filterPolicy: { },
deadLetterQueue: deadLetterQueue,
}));
Initializer
new SnsEventSource(topic: ITopic, props?: SnsEventSourceProps)
Parameters
- topic
ITopic
- props
Sns
Event Source Props
Properties
Name | Type | Description |
---|---|---|
topic | ITopic |
topic
Type:
ITopic
Methods
Name | Description |
---|---|
bind(target) | Called by lambda.addEventSource to allow the event source to bind to this function. |
bind(target)
public bind(target: IFunction): void
Parameters
- target
IFunction
Called by lambda.addEventSource
to allow the event source to bind to this function.