@aws-cdk/aws-sns
- Version 1.204.0
- Published
- 591 kB
- 8 dependencies
- Apache-2.0 license
Install
npm i @aws-cdk/aws-sns
yarn add @aws-cdk/aws-sns
pnpm add @aws-cdk/aws-sns
Overview
The CDK Construct Library for AWS::SNS
Index
Classes
Interfaces
ITopic
- metric()
- metricNumberOfMessagesPublished()
- metricNumberOfNotificationsDelivered()
- metricNumberOfNotificationsFailed()
- metricNumberOfNotificationsFilteredOut()
- metricNumberOfNotificationsFilteredOutInvalidAttributes()
- metricNumberOfNotificationsFilteredOutNoMessageAttributes()
- metricPublishSize()
- metricSMSMonthToDateSpentUSD()
- metricSMSSuccessRate()
TopicBase
- metric()
- metricNumberOfMessagesPublished()
- metricNumberOfNotificationsDelivered()
- metricNumberOfNotificationsFailed()
- metricNumberOfNotificationsFilteredOut()
- metricNumberOfNotificationsFilteredOutInvalidAttributes()
- metricNumberOfNotificationsFilteredOutNoMessageAttributes()
- metricPublishSize()
- metricSMSMonthToDateSpentUSD()
- metricSMSSuccessRate()
Enums
Namespaces
Classes
class CfnSubscription
class CfnSubscription extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::SNS::Subscription
The
AWS::SNS::Subscription
resource subscribes an endpoint to an Amazon SNS topic. For a subscription to be created, the owner of the endpoint must confirm the subscription.AWS::SNS::Subscription external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html
constructor
constructor(scope: cdk.Construct, id: string, props: CfnSubscriptionProps);
Create a new
AWS::SNS::Subscription
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property deliveryPolicy
deliveryPolicy: any;
The delivery policy JSON assigned to the subscription. Enables the subscriber to define the message delivery retry strategy in the case of an HTTP/S endpoint subscribed to the topic. For more information, see
[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* and [Message delivery retries](https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html) in the *Amazon SNS Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-deliverypolicy
property endpoint
endpoint: string;
The subscription's endpoint. The endpoint value depends on the protocol that you specify. For more information, see the
Endpoint
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-endpoint
property filterPolicy
filterPolicy: any;
The filter policy JSON assigned to the subscription. Enables the subscriber to filter out unwanted messages. For more information, see
[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* and [Message filtering](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html) in the *Amazon SNS Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-filterpolicy
property filterPolicyScope
filterPolicyScope: string;
This attribute lets you choose the filtering scope by using one of the following string value types:
-
MessageAttributes
(default) - The filter is applied on the message attributes. -MessageBody
- The filter is applied on the message body.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-filterpolicyscope
property protocol
protocol: string;
The subscription's protocol. For more information, see the
Protocol
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-protocol
property rawMessageDelivery
rawMessageDelivery: any;
When set to
true
, enables raw message delivery. Raw messages don't contain any JSON formatting and can be sent to Amazon SQS and HTTP/S endpoints. For more information, see[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-rawmessagedelivery
property redrivePolicy
redrivePolicy: any;
When specified, sends undeliverable messages to the specified Amazon SQS dead-letter queue. Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is unreachable) or server errors (for example, when the service that powers the subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or reprocessing.
For more information about the redrive policy and dead-letter queues, see [Amazon SQS dead-letter queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) in the *Amazon SQS Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-redrivepolicy
property region
region: string;
For cross-region subscriptions, the region in which the topic resides.
If no region is specified, AWS CloudFormation uses the region of the caller as the default.
If you perform an update operation that only updates the
Region
property of aAWS::SNS::Subscription
resource, that operation will fail unless you are either:- Updating the
Region
fromNULL
to the caller region. - Updating theRegion
from the caller region toNULL
.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region
property subscriptionRoleArn
subscriptionRoleArn: string;
This property applies only to Amazon Kinesis Data Firehose delivery stream subscriptions. Specify the ARN of the IAM role that has the following:
- Permission to write to the Amazon Kinesis Data Firehose delivery stream - Amazon SNS listed as a trusted entity
Specifying a valid ARN for this attribute is required for Kinesis Data Firehose delivery stream subscriptions. For more information, see [Fanout to Amazon Kinesis Data Firehose delivery streams](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html) in the *Amazon SNS Developer Guide.*
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-subscriptionrolearn
property topicArn
topicArn: string;
The ARN of the topic to subscribe to.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#topicarn
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnTopic
class CfnTopic extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::SNS::Topic
The
AWS::SNS::Topic
resource creates a topic to which notifications can be published.> One account can create a maximum of 100,000 standard topics and 1,000 FIFO topics. For more information, see [Amazon SNS endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/sns.html) in the *AWS General Reference* .
AWS::SNS::Topic external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html
constructor
constructor(scope: cdk.Construct, id: string, props?: CfnTopicProps);
Create a new
AWS::SNS::Topic
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property attrTopicArn
readonly attrTopicArn: string;
Returns the ARN of an Amazon SNS topic. TopicArn
property attrTopicName
readonly attrTopicName: string;
Returns the name of an Amazon SNS topic. TopicName
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property contentBasedDeduplication
contentBasedDeduplication: any;
Enables content-based deduplication for FIFO topics.
- By default,
ContentBasedDeduplication
is set tofalse
. If you create a FIFO topic and this attribute isfalse
, you must specify a value for theMessageDeduplicationId
parameter for the [Publish](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html) action. - When you setContentBasedDeduplication
totrue
, Amazon SNS uses a SHA-256 hash to generate theMessageDeduplicationId
using the body of the message (but not the attributes of the message).(Optional) To override the generated value, you can specify a value for the the
MessageDeduplicationId
parameter for thePublish
action.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-contentbaseddeduplication
property dataProtectionPolicy
dataProtectionPolicy: any;
The body of the policy document you want to use for this topic.
You can only add one policy per topic.
The policy must be in JSON string format.
Length Constraints: Maximum length of 30,720.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-dataprotectionpolicy
property displayName
displayName: string;
The display name to use for an Amazon SNS topic with SMS subscriptions. The display name must be maximum 100 characters long, including hyphens (-), underscores (_), spaces, and tabs.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-displayname
property fifoTopic
fifoTopic: any;
Set to true to create a FIFO topic.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-fifotopic
property kmsMasterKeyId
kmsMasterKeyId: string;
The ID of an AWS managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see [Key terms](https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms) . For more examples, see
[KeyId](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters)
in the *AWS Key Management Service API Reference* .This property applies only to [server-side-encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html) .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-kmsmasterkeyid
property signatureVersion
signatureVersion: string;
The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By default,
SignatureVersion
is set to1
.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-signatureversion
property subscription
subscription: any;
The Amazon SNS subscriptions (endpoints) for this topic.
> If you specify the
Subscription
property in theAWS::SNS::Topic
resource and it creates an associated subscription resource, the associated subscription is not deleted when theAWS::SNS::Topic
resource is deleted.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-subscription
property tags
readonly tags: cdk.TagManager;
The list of tags to add to a new topic.
> To be able to tag a topic on creation, you must have the
sns:CreateTopic
andsns:TagResource
permissions.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-tags
property topicName
topicName: string;
The name of the topic you want to create. Topic names must include only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. FIFO topic names must end with
.fifo
.If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the topic name. For more information, see [Name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html) .
> If you specify a name, you can't perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-topicname
property tracingConfig
tracingConfig: string;
Tracing mode of an Amazon SNS topic. By default
TracingConfig
is set toPassThrough
, and the topic passes through the tracing header it receives from an SNS publisher to its subscriptions. If set toActive
, SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. Only supported on standard topics.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-tracingconfig
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnTopicPolicy
class CfnTopicPolicy extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::SNS::TopicPolicy
The
AWS::SNS::TopicPolicy
resource associates Amazon SNS topics with a policy. For an example snippet, see [Declaring an Amazon SNS policy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-iam.html#scenario-sns-policy) in the *AWS CloudFormation User Guide* .AWS::SNS::TopicPolicy external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html
constructor
constructor(scope: cdk.Construct, id: string, props: CfnTopicPolicyProps);
Create a new
AWS::SNS::TopicPolicy
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property policyDocument
policyDocument: any;
A policy document that contains permissions to add to the specified SNS topics.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-policydocument
property topics
topics: string[];
The Amazon Resource Names (ARN) of the topics to which you want to add the policy. You can use the
[Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)
function to specify an[AWS::SNS::Topic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html)
resource.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-topics
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class Subscription
class Subscription extends Resource {}
A new subscription.
Prefer to use the
ITopic.addSubscription()
methods to create instances of this class.
constructor
constructor(scope: Construct, id: string, props: SubscriptionProps);
property deadLetterQueue
readonly deadLetterQueue?: IQueue;
The DLQ associated with this subscription if present.
class SubscriptionFilter
class SubscriptionFilter {}
A subscription filter for an attribute.
constructor
constructor(conditions?: any[]);
Parameter conditions
conditions that specify the message attributes that should be included, excluded, matched, etc.
property conditions
readonly conditions: any[];
method existsFilter
static existsFilter: () => SubscriptionFilter;
Returns a subscription filter for attribute key matching.
method numericFilter
static numericFilter: ( numericConditions: NumericConditions) => SubscriptionFilter;
Returns a subscription filter for a numeric attribute.
method stringFilter
static stringFilter: (stringConditions: StringConditions) => SubscriptionFilter;
Returns a subscription filter for a string attribute.
class Topic
class Topic extends TopicBase {}
A new SNS topic
constructor
constructor(scope: Construct, id: string, props?: TopicProps);
property autoCreatePolicy
protected readonly autoCreatePolicy: boolean;
property fifo
readonly fifo: boolean;
property topicArn
readonly topicArn: string;
property topicName
readonly topicName: string;
method fromTopicArn
static fromTopicArn: (scope: Construct, id: string, topicArn: string) => ITopic;
Import an existing SNS topic provided an ARN
Parameter scope
The parent creating construct
Parameter id
The construct's name
Parameter topicArn
topic ARN (i.e. arn:aws:sns:us-east-2:444455556666:MyTopic)
class TopicBase
abstract class TopicBase extends Resource implements ITopic {}
Either a new or imported Topic
property autoCreatePolicy
protected abstract readonly autoCreatePolicy: boolean;
Controls automatic creation of policy objects.
Set by subclasses.
property fifo
abstract readonly fifo: boolean;
property topicArn
abstract readonly topicArn: string;
property topicName
abstract readonly topicName: string;
method addSubscription
addSubscription: (subscription: ITopicSubscription) => void;
Subscribe some endpoint to this topic
method addToResourcePolicy
addToResourcePolicy: ( statement: iam.PolicyStatement) => iam.AddToResourcePolicyResult;
Adds a statement to the IAM resource policy associated with this topic.
If this topic was created in this stack (
new Topic
), a topic policy will be automatically created upon the first call toaddToPolicy
. If the topic is imported (Topic.import
), then this is a no-op.
method bindAsNotificationRuleTarget
bindAsNotificationRuleTarget: ( _scope: constructs.Construct) => notifications.NotificationRuleTargetConfig;
Represents a notification target That allows SNS topic to associate with this rule target.
method grantPublish
grantPublish: (grantee: iam.IGrantable) => iam.Grant;
Grant topic publishing permissions to the given identity
method validate
protected validate: () => string[];
class TopicPolicy
class TopicPolicy extends Resource {}
The policy for an SNS Topic
Policies define the operations that are allowed on this resource.
You almost never need to define this construct directly.
All AWS resources that support resource policies have a method called
addToResourcePolicy()
, which will automatically create a new resource policy if one doesn't exist yet, otherwise it will add to the existing policy.Prefer to use
addToResourcePolicy()
instead.
constructor
constructor(scope: Construct, id: string, props: TopicPolicyProps);
property document
readonly document: PolicyDocument;
The IAM policy document for this policy.
Interfaces
interface BetweenCondition
interface BetweenCondition {}
Between condition for a numeric attribute.
interface CfnSubscriptionProps
interface CfnSubscriptionProps {}
Properties for defining a
CfnSubscription
external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html
property deliveryPolicy
readonly deliveryPolicy?: any | cdk.IResolvable;
The delivery policy JSON assigned to the subscription. Enables the subscriber to define the message delivery retry strategy in the case of an HTTP/S endpoint subscribed to the topic. For more information, see
[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* and [Message delivery retries](https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html) in the *Amazon SNS Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-deliverypolicy
property endpoint
readonly endpoint?: string;
The subscription's endpoint. The endpoint value depends on the protocol that you specify. For more information, see the
Endpoint
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-endpoint
property filterPolicy
readonly filterPolicy?: any | cdk.IResolvable;
The filter policy JSON assigned to the subscription. Enables the subscriber to filter out unwanted messages. For more information, see
[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* and [Message filtering](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html) in the *Amazon SNS Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-filterpolicy
property filterPolicyScope
readonly filterPolicyScope?: string;
This attribute lets you choose the filtering scope by using one of the following string value types:
-
MessageAttributes
(default) - The filter is applied on the message attributes. -MessageBody
- The filter is applied on the message body.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-filterpolicyscope
property protocol
readonly protocol: string;
The subscription's protocol. For more information, see the
Protocol
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-protocol
property rawMessageDelivery
readonly rawMessageDelivery?: boolean | cdk.IResolvable;
When set to
true
, enables raw message delivery. Raw messages don't contain any JSON formatting and can be sent to Amazon SQS and HTTP/S endpoints. For more information, see[GetSubscriptionAttributes](https://docs.aws.amazon.com/sns/latest/api/API_GetSubscriptionAttributes.html)
in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-rawmessagedelivery
property redrivePolicy
readonly redrivePolicy?: any | cdk.IResolvable;
When specified, sends undeliverable messages to the specified Amazon SQS dead-letter queue. Messages that can't be delivered due to client errors (for example, when the subscribed endpoint is unreachable) or server errors (for example, when the service that powers the subscribed endpoint becomes unavailable) are held in the dead-letter queue for further analysis or reprocessing.
For more information about the redrive policy and dead-letter queues, see [Amazon SQS dead-letter queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) in the *Amazon SQS Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-redrivepolicy
property region
readonly region?: string;
For cross-region subscriptions, the region in which the topic resides.
If no region is specified, AWS CloudFormation uses the region of the caller as the default.
If you perform an update operation that only updates the
Region
property of aAWS::SNS::Subscription
resource, that operation will fail unless you are either:- Updating the
Region
fromNULL
to the caller region. - Updating theRegion
from the caller region toNULL
.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region
property subscriptionRoleArn
readonly subscriptionRoleArn?: string;
This property applies only to Amazon Kinesis Data Firehose delivery stream subscriptions. Specify the ARN of the IAM role that has the following:
- Permission to write to the Amazon Kinesis Data Firehose delivery stream - Amazon SNS listed as a trusted entity
Specifying a valid ARN for this attribute is required for Kinesis Data Firehose delivery stream subscriptions. For more information, see [Fanout to Amazon Kinesis Data Firehose delivery streams](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html) in the *Amazon SNS Developer Guide.*
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-subscriptionrolearn
property topicArn
readonly topicArn: string;
The ARN of the topic to subscribe to.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#topicarn
interface CfnTopicPolicyProps
interface CfnTopicPolicyProps {}
Properties for defining a
CfnTopicPolicy
external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html
property policyDocument
readonly policyDocument: any | cdk.IResolvable;
A policy document that contains permissions to add to the specified SNS topics.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-policydocument
property topics
readonly topics: string[];
The Amazon Resource Names (ARN) of the topics to which you want to add the policy. You can use the
[Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)
function to specify an[AWS::SNS::Topic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html)
resource.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-policy.html#cfn-sns-topicpolicy-topics
interface CfnTopicProps
interface CfnTopicProps {}
Properties for defining a
CfnTopic
external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html
property contentBasedDeduplication
readonly contentBasedDeduplication?: boolean | cdk.IResolvable;
Enables content-based deduplication for FIFO topics.
- By default,
ContentBasedDeduplication
is set tofalse
. If you create a FIFO topic and this attribute isfalse
, you must specify a value for theMessageDeduplicationId
parameter for the [Publish](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html) action. - When you setContentBasedDeduplication
totrue
, Amazon SNS uses a SHA-256 hash to generate theMessageDeduplicationId
using the body of the message (but not the attributes of the message).(Optional) To override the generated value, you can specify a value for the the
MessageDeduplicationId
parameter for thePublish
action.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-contentbaseddeduplication
property dataProtectionPolicy
readonly dataProtectionPolicy?: any | cdk.IResolvable;
The body of the policy document you want to use for this topic.
You can only add one policy per topic.
The policy must be in JSON string format.
Length Constraints: Maximum length of 30,720.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-dataprotectionpolicy
property displayName
readonly displayName?: string;
The display name to use for an Amazon SNS topic with SMS subscriptions. The display name must be maximum 100 characters long, including hyphens (-), underscores (_), spaces, and tabs.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-displayname
property fifoTopic
readonly fifoTopic?: boolean | cdk.IResolvable;
Set to true to create a FIFO topic.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-fifotopic
property kmsMasterKeyId
readonly kmsMasterKeyId?: string;
The ID of an AWS managed customer master key (CMK) for Amazon SNS or a custom CMK. For more information, see [Key terms](https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html#sse-key-terms) . For more examples, see
[KeyId](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters)
in the *AWS Key Management Service API Reference* .This property applies only to [server-side-encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-server-side-encryption.html) .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-kmsmasterkeyid
property signatureVersion
readonly signatureVersion?: string;
The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. By default,
SignatureVersion
is set to1
.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-signatureversion
property subscription
readonly subscription?: | Array<CfnTopic.SubscriptionProperty | cdk.IResolvable> | cdk.IResolvable;
The Amazon SNS subscriptions (endpoints) for this topic.
> If you specify the
Subscription
property in theAWS::SNS::Topic
resource and it creates an associated subscription resource, the associated subscription is not deleted when theAWS::SNS::Topic
resource is deleted.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-subscription
property tags
readonly tags?: cdk.CfnTag[];
The list of tags to add to a new topic.
> To be able to tag a topic on creation, you must have the
sns:CreateTopic
andsns:TagResource
permissions.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-tags
property topicName
readonly topicName?: string;
The name of the topic you want to create. Topic names must include only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. FIFO topic names must end with
.fifo
.If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the topic name. For more information, see [Name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html) .
> If you specify a name, you can't perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-topicname
property tracingConfig
readonly tracingConfig?: string;
Tracing mode of an Amazon SNS topic. By default
TracingConfig
is set toPassThrough
, and the topic passes through the tracing header it receives from an SNS publisher to its subscriptions. If set toActive
, SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. Only supported on standard topics.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#cfn-sns-topic-tracingconfig
interface ITopic
interface ITopic extends IResource, notifications.INotificationRuleTarget {}
Represents an SNS topic
property fifo
readonly fifo: boolean;
Whether this topic is an Amazon SNS FIFO queue. If false, this is a standard topic.
property topicArn
readonly topicArn: string;
The ARN of the topic
property topicName
readonly topicName: string;
The name of the topic
method addSubscription
addSubscription: (subscription: ITopicSubscription) => void;
Subscribe some endpoint to this topic
method addToResourcePolicy
addToResourcePolicy: ( statement: iam.PolicyStatement) => iam.AddToResourcePolicyResult;
Adds a statement to the IAM resource policy associated with this topic.
If this topic was created in this stack (
new Topic
), a topic policy will be automatically created upon the first call toaddToPolicy
. If the topic is imported (Topic.import
), then this is a no-op.
method grantPublish
grantPublish: (identity: iam.IGrantable) => iam.Grant;
Grant topic publishing permissions to the given identity
interface ITopic
interface ITopic {}
method metric
metric: ( metricName: string, props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
Return the given named metric for this Topic
method metricNumberOfMessagesPublished
metricNumberOfMessagesPublished: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages published to your Amazon SNS topics.
Sum over 5 minutes
method metricNumberOfNotificationsDelivered
metricNumberOfNotificationsDelivered: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.
Sum over 5 minutes
method metricNumberOfNotificationsFailed
metricNumberOfNotificationsFailed: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that Amazon SNS failed to deliver.
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOut
metricNumberOfNotificationsFilteredOut: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies.
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOutInvalidAttributes
metricNumberOfNotificationsFilteredOutInvalidAttributes: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOutNoMessageAttributes
metricNumberOfNotificationsFilteredOutNoMessageAttributes: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies because the messages have no attributes.
Sum over 5 minutes
method metricPublishSize
metricPublishSize: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
Metric for the size of messages published through this topic
Average over 5 minutes
method metricSMSMonthToDateSpentUSD
metricSMSMonthToDateSpentUSD: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The charges you have accrued since the start of the current calendar month for sending SMS messages.
Maximum over 5 minutes
method metricSMSSuccessRate
metricSMSSuccessRate: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The rate of successful SMS message deliveries.
Sum over 5 minutes
interface ITopicSubscription
interface ITopicSubscription {}
Topic subscription
method bind
bind: (topic: ITopic) => TopicSubscriptionConfig;
Returns a configuration used to subscribe to an SNS topic
Parameter topic
topic for which subscription will be configured
interface NumericConditions
interface NumericConditions {}
Conditions that can be applied to numeric attributes.
property allowlist
readonly allowlist?: number[];
Match one or more values.
- None
property between
readonly between?: BetweenCondition;
Match values that are between the specified values.
- None
property betweenStrict
readonly betweenStrict?: BetweenCondition;
Match values that are strictly between the specified values.
- None
property greaterThan
readonly greaterThan?: number;
Match values that are greater than the specified value.
- None
property greaterThanOrEqualTo
readonly greaterThanOrEqualTo?: number;
Match values that are greater than or equal to the specified value.
- None
property lessThan
readonly lessThan?: number;
Match values that are less than the specified value.
- None
property lessThanOrEqualTo
readonly lessThanOrEqualTo?: number;
Match values that are less than or equal to the specified value.
- None
property whitelist
readonly whitelist?: number[];
Match one or more values.
Deprecated
use
allowlist
- None
interface StringConditions
interface StringConditions {}
Conditions that can be applied to string attributes.
property allowlist
readonly allowlist?: string[];
Match one or more values. - None
property blacklist
readonly blacklist?: string[];
Match any value that doesn't include any of the specified values.
Deprecated
use
denylist
- None
property denylist
readonly denylist?: string[];
Match any value that doesn't include any of the specified values. - None
property matchPrefixes
readonly matchPrefixes?: string[];
Matches values that begins with the specified prefixes.
- None
property whitelist
readonly whitelist?: string[];
Match one or more values.
Deprecated
use
allowlist
- None
interface SubscriptionOptions
interface SubscriptionOptions {}
Options for creating a new subscription
property deadLetterQueue
readonly deadLetterQueue?: IQueue;
Queue to be used as dead letter queue. If not passed no dead letter queue is enabled.
- No dead letter queue enabled.
property endpoint
readonly endpoint: string;
The subscription endpoint.
The meaning of this value depends on the value for 'protocol'.
property filterPolicy
readonly filterPolicy?: { [attribute: string]: SubscriptionFilter;};
The filter policy.
- all messages are delivered
property protocol
readonly protocol: SubscriptionProtocol;
What type of subscription to add.
property rawMessageDelivery
readonly rawMessageDelivery?: 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.
false
property region
readonly region?: string;
The region where the topic resides, in the case of cross-region subscriptions https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region - the region where the CloudFormation stack is being deployed.
property subscriptionRoleArn
readonly subscriptionRoleArn?: string;
Arn of role allowing access to firehose delivery stream. Required for a firehose subscription protocol. - No subscription role is provided
interface SubscriptionProps
interface SubscriptionProps extends SubscriptionOptions {}
Properties for creating a new subscription
property topic
readonly topic: ITopic;
The topic to subscribe to.
interface TopicBase
interface TopicBase {}
method metric
metric: ( metricName: string, props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
Return the given named metric for this Topic
method metricNumberOfMessagesPublished
metricNumberOfMessagesPublished: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages published to your Amazon SNS topics.
Sum over 5 minutes
method metricNumberOfNotificationsDelivered
metricNumberOfNotificationsDelivered: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.
Sum over 5 minutes
method metricNumberOfNotificationsFailed
metricNumberOfNotificationsFailed: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that Amazon SNS failed to deliver.
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOut
metricNumberOfNotificationsFilteredOut: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies.
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOutInvalidAttributes
metricNumberOfNotificationsFilteredOutInvalidAttributes: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies because the messages' attributes are invalid
Sum over 5 minutes
method metricNumberOfNotificationsFilteredOutNoMessageAttributes
metricNumberOfNotificationsFilteredOutNoMessageAttributes: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The number of messages that were rejected by subscription filter policies because the messages have no attributes.
Sum over 5 minutes
method metricPublishSize
metricPublishSize: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
Metric for the size of messages published through this topic
Average over 5 minutes
method metricSMSMonthToDateSpentUSD
metricSMSMonthToDateSpentUSD: ( props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The charges you have accrued since the start of the current calendar month for sending SMS messages.
Maximum over 5 minutes
method metricSMSSuccessRate
metricSMSSuccessRate: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
The rate of successful SMS message deliveries.
Sum over 5 minutes
interface TopicPolicyProps
interface TopicPolicyProps {}
Properties to associate SNS topics with a policy
property policyDocument
readonly policyDocument?: PolicyDocument;
IAM policy document to apply to topic(s). empty policy document
property topics
readonly topics: ITopic[];
The set of topics this policy applies to.
interface TopicProps
interface TopicProps {}
Properties for a new SNS topic
property contentBasedDeduplication
readonly contentBasedDeduplication?: boolean;
Enables content-based deduplication for FIFO topics.
None
property displayName
readonly displayName?: string;
A developer-defined string that can be used to identify this SNS topic.
None
property fifo
readonly fifo?: boolean;
Set to true to create a FIFO topic.
None
property masterKey
readonly masterKey?: IKey;
A KMS Key, either managed by this CDK app, or imported.
None
property topicName
readonly topicName?: string;
A name for the topic.
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the topic name. For more information, see Name Type.
Generated name
interface TopicSubscriptionConfig
interface TopicSubscriptionConfig extends SubscriptionOptions {}
Subscription configuration
property subscriberId
readonly subscriberId: string;
The id of the SNS subscription resource created under
scope
. In most cases, it is recommended to use theuniqueId
of the topic you are subscribing to.
property subscriberScope
readonly subscriberScope?: Construct;
The scope in which to create the SNS subscription resource. Normally you'd want the subscription to be created on the consuming stack because the topic is usually referenced by the consumer's resource policy (e.g. SQS queue policy). Otherwise, it will cause a cyclic reference.
If this is undefined, the subscription will be created on the topic's stack.
- use the topic as the scope of the subscription, in which case
subscriberId
must be defined.
Enums
enum SubscriptionProtocol
enum SubscriptionProtocol { HTTP = 'http', HTTPS = 'https', EMAIL = 'email', EMAIL_JSON = 'email-json', SMS = 'sms', SQS = 'sqs', APPLICATION = 'application', LAMBDA = 'lambda', FIREHOSE = 'firehose',}
The type of subscription, controlling the type of the endpoint parameter.
member APPLICATION
APPLICATION = 'application'
JSON-encoded notifications are sent to a mobile app endpoint.
member EMAIL
EMAIL = 'email'
Notifications are sent via email.
member EMAIL_JSON
EMAIL_JSON = 'email-json'
Notifications are JSON-encoded and sent via mail.
member FIREHOSE
FIREHOSE = 'firehose'
Notifications put records into a firehose delivery stream.
member HTTP
HTTP = 'http'
JSON-encoded message is POSTED to an HTTP url.
member HTTPS
HTTPS = 'https'
JSON-encoded message is POSTed to an HTTPS url.
member LAMBDA
LAMBDA = 'lambda'
Notifications trigger a Lambda function.
member SMS
SMS = 'sms'
Notification is delivered by SMS
member SQS
SQS = 'sqs'
Notifications are enqueued into an SQS queue.
Namespaces
namespace CfnTopic
namespace CfnTopic {}
interface SubscriptionProperty
interface SubscriptionProperty {}
Subscription
is an embedded property that describes the subscription endpoints of an Amazon SNS topic.> For full control over subscription behavior (for example, delivery policy, filtering, raw message delivery, and cross-region subscriptions), use the [AWS::SNS::Subscription](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html) resource.
external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic-subscription.html
property endpoint
readonly endpoint: string;
The endpoint that receives notifications from the Amazon SNS topic. The endpoint value depends on the protocol that you specify. For more information, see the
Endpoint
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic-subscription.html#cfn-sns-topic-subscription-endpoint
property protocol
readonly protocol: string;
The subscription's protocol. For more information, see the
Protocol
parameter of the[Subscribe](https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html)
action in the *Amazon SNS API Reference* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic-subscription.html#cfn-sns-topic-subscription-protocol
Package Files (9)
Dependencies (8)
Dev Dependencies (8)
Peer Dependencies (8)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@aws-cdk/aws-sns
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@aws-cdk/aws-sns)
- HTML<a href="https://www.jsdocs.io/package/@aws-cdk/aws-sns"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 5285 ms. - Missing or incorrect documentation? Open an issue for this package.