SnsEventSource

class aws_cdk.aws_lambda_event_sources.SnsEventSource(topic, *, dead_letter_queue=None, filter_policy=None)

Bases: object

Use an Amazon SNS topic as an event source for AWS Lambda.

Example:

import aws_cdk.aws_sns as sns
from aws_cdk.aws_lambda_event_sources import SnsEventSource

# topic is of type Topic

# fn is of type Function

dead_letter_queue = sqs.Queue(self, "deadLetterQueue")
fn.add_event_source(SnsEventSource(topic,
    filter_policy={},
    dead_letter_queue=dead_letter_queue
))
Parameters
  • topic (ITopic) –

  • dead_letter_queue (Optional[IQueue]) – Queue to be used as dead letter queue. If not passed no dead letter queue is enabled. Default: - No dead letter queue enabled.

  • filter_policy (Optional[Mapping[str, SubscriptionFilter]]) – The filter policy. Default: - all messages are delivered

Methods

bind(target)

Called by lambda.addEventSource to allow the event source to bind to this function.

Parameters

target (IFunction) –

Return type

None

Attributes

topic
Return type

ITopic