Skip to content

SnsTopicLambdaSubscriber

Reference doc for the `sst.aws.SnsTopicLambdaSubscriber` component.

The SnsTopicLambdaSubscriber component is internally used by the SnsTopic component to add subscriptions to your Amazon SNS Topic.

You’ll find this component returned by the subscribe method of the SnsTopic component.


Constructor

new SnsTopicLambdaSubscriber(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.function

Type Output<Function>

The Lambda function that’ll be notified.

nodes.permission

Type Permission

The Lambda permission.

nodes.subscription

Type TopicSubscription

The SNS Topic subscription.

Args

filter?

Type Input<Record<string, any>>

Filter the messages that’ll be processed by the subscriber.

If any single property in the filter doesn’t match an attribute assigned to the message, then the policy rejects the message.

For example, if your SNS Topic message contains this in a JSON format.

{
store: "example_corp",
event: "order-placed",
customer_interests: [
"soccer",
"rugby",
"hockey"
],
price_usd: 210.75
}

Then this filter policy accepts the message.

{
filter: {
store: ["example_corp"],
event: [{"anything-but": "order_cancelled"}],
customer_interests: [
"rugby",
"football",
"baseball"
],
price_usd: [{numeric: [">=", 100]}]
}
}

subscriber

Type Input<string | FunctionArgs>

The subscriber function.

topic

Type Input<Object>

The Topic to use.

topic.arn

Type Input<string>

The ARN of the Topic.

transform?

Type Object

Transform how this subscription creates its underlying resources.

transform.subscription?

Type TopicSubscriptionArgs | (args: TopicSubscriptionArgs, opts: ComponentResourceOptions, name: string) => void

Transform the SNS Topic Subscription resource.