aws-cdk-lib.aws_lambda_event_sources.SnsEventSource

class SnsEventSource

LanguageType name
.NETAmazon.CDK.AWS.Lambda.EventSources.SnsEventSource
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#SnsEventSource
Javasoftware.amazon.awscdk.services.lambda.eventsources.SnsEventSource
Pythonaws_cdk.aws_lambda_event_sources.SnsEventSource
TypeScript (source)aws-cdk-lib » aws_lambda_event_sources » SnsEventSource

Implements IEventSource

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 SnsEventSourceProps

Properties

NameTypeDescription
topicITopic

topic

Type: ITopic

Methods

NameDescription
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.