SnsEventSourceProps

class aws_cdk.aws_lambda_event_sources.SnsEventSourceProps(*, dead_letter_queue=None, filter_policy=None, filter_policy_with_message_body=None)

Bases: LambdaSubscriptionProps

Properties forwarded to the Lambda Subscription.

Parameters:
  • 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

  • filter_policy_with_message_body (Optional[Mapping[str, FilterOrPolicy]]) – The filter policy that is applied on the message body. To apply a filter policy to the message attributes, use filterPolicy. A maximum of one of filterPolicyWithMessageBody and filterPolicy may be used. Default: - all messages are delivered

ExampleMetadata:

infused

Example:

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

# topic: sns.Topic

# fn: lambda.Function

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

Attributes

dead_letter_queue

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

The filter policy.

Default:
  • all messages are delivered

filter_policy_with_message_body

The filter policy that is applied on the message body.

To apply a filter policy to the message attributes, use filterPolicy. A maximum of one of filterPolicyWithMessageBody and filterPolicy may be used.

Default:
  • all messages are delivered