AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Subscription

A new subscription. Prefer to use the `ITopic.addSubscription()` methods to create instances of this class.

Import

import { Subscription } from 'aws-cdk-lib/aws-sns';

Or use the module namespace:

import * as sns from 'aws-cdk-lib/aws-sns';
// sns.Subscription

Properties

Configuration passed to the constructor as SubscriptionProps.

topicRequired
ITopic

The topic to subscribe to.

9 properties inherited from SubscriptionOptions
endpointRequiredinherited from SubscriptionOptions
string

The subscription endpoint. The meaning of this value depends on the value for 'protocol'.

protocolRequiredinherited from SubscriptionOptions
SubscriptionProtocol

What type of subscription to add.

deadLetterQueueOptionalinherited from SubscriptionOptions
IQueue

Queue to be used as dead letter queue. If not passed no dead letter queue is enabled.

Default: - No dead letter queue enabled.

deliveryPolicyOptionalinherited from SubscriptionOptions
DeliveryPolicy

The delivery policy.

Default: - if the initial delivery of the message fails, three retries with a delay between failed attempts set at 20 seconds

filterPolicyOptionalinherited from SubscriptionOptions
{ [key: string]: SubscriptionFilter }

The filter policy.

Default: - all messages are delivered

filterPolicyWithMessageBodyOptionalinherited from SubscriptionOptions
{ [key: string]: 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

rawMessageDeliveryOptionalinherited from SubscriptionOptions
boolean

true if raw message delivery is enabled for the subscription. Raw messages are free of JSON formatting and can be sent to HTTP/S and Amazon SQS endpoints. For more information, see GetSubscriptionAttributes in the Amazon Simple Notification Service API Reference.

Default: false

regionOptionalinherited from SubscriptionOptions
string

The region where the topic resides, in the case of cross-region subscriptions.

Default: - the region where the CloudFormation stack is being deployed.

subscriptionRoleArnOptionalinherited from SubscriptionOptions
string

Arn of role allowing access to firehose delivery stream. Required for a firehose subscription protocol.

Default: - No subscription role is provided

Get the Amazon SNS Cheat Sheet

Everything you need to know about Amazon SNS on one page. HD quality, print-friendly.

Download Free Infographic