SNS - AWS Serverless Application Model

SNS

The object describing an SNS event source type.

SAM generates AWS::SNS::Subscription resource when this event type is set

Syntax

To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.

Properties

FilterPolicy

The filter policy JSON assigned to the subscription. For more information, see GetSubscriptionAttributes in the Amazon Simple Notification Service API Reference.

Type: SnsFilterPolicy

Required: No

AWS CloudFormation compatibility: This property is passed directly to the FilterPolicy property of an AWS::SNS::Subscription resource.

Region

For cross-region subscriptions, the region in which the topic resides.

If no region is specified, CloudFormation uses the region of the caller as the default.

Type: String

Required: No

AWS CloudFormation compatibility: This property is passed directly to the Region property of an AWS::SNS::Subscription resource.

SqsSubscription

Set this property to true, or specify SqsSubscriptionObject to enable batching SNS topic notifications in an SQS queue. Setting this property to true creates a new SQS queue, whereas specifying a SqsSubscriptionObject uses an existing SQS queue.

Type: Boolean | SqsSubscriptionObject

Required: No

AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.

Topic

The ARN of the topic to subscribe to.

Type: String

Required: Yes

AWS CloudFormation compatibility: This property is passed directly to the TopicArn property of an AWS::SNS::Topic resource.

Examples

SNS Event Source Example

SNS Event Source Example

YAML

Properties: Topic: arn:aws:sns:us-east-1:123456789012:my_topic SqsSubscription: True FilterPolicy: store: - example_corp price_usd: - numeric: - ">=" - 100