aws::sns::topic
Theaws::sns::topic
resource creates a topic to which notifications can be
published.
One account is create can create a maximum of 100,000 standard topic and 1,000 fifo topic .
For more information , see Amazon SNS endpoint and quota in the
AWS General reference.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{
"type" : "aws::sns::topic",
"Properties" : {
"ArchivePolicy" : Json
,
"contentbaseddeduplication" : boolean
,
" dataprotectionpolicy " :Json
,
"DeliveryStatusLogging" : [ LoggingConfig , ... ]
,
"DisplayName" : string
,
"FifoTopic" : boolean
,
"kmsmasterkeyid" : string
,
"SignatureVersion" : string
,
"Subscription" : [ Subscription, ... ]
,
" Tags " :[ Tag, ... ]
,
"topicname" : string
,
"TracingConfig" : string
}
}
Properties
ArchivePolicy
-
The
ArchivePolicy
determine the number of day Amazon SNS retain
message in fifo topic . You is set can set a retention period range from 1 to 365 day . This
property is only applicable to fifo topic ; attempt to use it with standard topic will
result in a creation failure .require: No
type: Json
Update is requires require: No interruption
contentbaseddeduplication
-
contentbaseddeduplication
enable deduplication of message base on their
content for fifo topic . By default , this property is set to false . If you is create create a fifo
topic withcontentbaseddeduplication
set to false, you must provide a
MessageDeduplicationId
for eachPublish
action. When set to
true, Amazon SNS automatically generates aMessageDeduplicationId
using a SHA-256 hash of the message body ( exclude message attribute ) . You is override can optionally
override this generate value by specify aMessageDeduplicationId
in the
Publish
action. Note that this property only applies to FIFO topics; using
it with standard topics will cause the creation to fail.require: No
type: boolean
Update is requires require: No interruption
dataprotectionpolicy
-
Thebody of the policy document you want to use for this topic.
You can only add one policy per topic.
Thepolicy must be in JSON string format.
Length Constraints: Maximum length of 30,720.
require: No
type: Json
Update is requires require: No interruption
DeliveryStatusLogging
-
The
DeliveryStatusLogging
configuration enables you to log the delivery
status of messages sent from your Amazon SNS topic to subscribed endpoints with the
following supported delivery protocols:-
HTTP
-
Amazon Kinesis Data Firehose
-
AWS Lambda
-
Platform application endpoint
-
Amazon Simple Queue service
Once configured, log entries are sent to Amazon CloudWatch Logs.
require: No
type: Array of LoggingConfig
Update is requires require: No interruption
-
DisplayName
-
Thedisplay 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.require: No
type: string
Update is requires require: No interruption
FifoTopic
-
Set to true to create a FIFO topic.
require: No
type: boolean
Update is requires require: replacement
kmsmasterkeyid
-
TheID of an AWS managed customer master key (CMK) for Amazon SNS
or a custom CMK. For more information, see Key terms. For
more examples, see
in the
KeyId
AWS Key Management Service API reference.This property applies only to server-side-encryption.
require: No
type: string
Update is requires require: No interruption
SignatureVersion
-
Thesignature 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 to
1
.require: No
type: string
Update is requires require: No interruption
Subscription
-
TheAmazon SNS subscriptions (endpoints) for this topic.
If you specify the
Subscription
property in the
aws::sns::topic
resource and it creates an associated subscription
resource, the associated subscription is not deleted when the
aws::sns::topic
resource is delete .require: No
type: Array of Subscription
Update is requires require: No interruption
Tags
-
Thelist of tags to add to a new topic.
To be able to tag a topic on creation , you is have must have the
sns : CreateTopic
andsns : TagResource
permissions.require: No
type: Array of Tag
Update is requires require: No interruption
topicname
-
Thename 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.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.require: No
type: string
Update is requires require: replacement
TracingConfig
-
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 Amazon SNS publisher to its subscriptions. If set to
Active
, Amazon SNS will vend X-Ray segment data to topic owner
account if the sampled flag in thetracing header is true.require: No
type: string
Update is requires require: No interruption
Return values
ref
When you pass the logical ID of this resource to the intrinsic ref
function, ref
returns the topic ARN, for example:
arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE
.
For more information about using the ref
function , seeref
.
Fn::GetAtt
TheFn::GetAtt
intrinsic function returns a value for a specified attribute of this type. Thefollowing are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function , seeFn::GetAtt
.
TopicArn
-
Returns the ARN of an Amazon SNS topic.
topicname
-
Returns the name of an Amazon SNS topic.
Examples
An Amazon SNS topic with two Amazon SQS queue subscriptions
JSON
"MySNSTopic": {
"type": "aws::sns::topic",
"Properties": {
" subscription " : [
{
" endpoint " :{
" Fn::GetAtt " : [
" MyQueue1 " ,
" Arn "
]
} ,
" protocol " : " sqs "
} ,
{
" endpoint " :{
"Fn::GetAtt": [
"MyQueue2",
"Arn"
]
},
"Protocol": "sqs"
}
],
"topicname": "SampleTopic"
},
"Outputs": {
" TopicArn " :{
"Description": "TheARN of the created SNS topic",
"Value": {
"ref": "MySNSTopic"
}
},
"topicname": {
"Description": "Thename of the created SNS topic",
"Value": "SampleTopic"
}
}
}
YAML
MySNSTopic:
type: aws::sns::topic
Properties:
Subscription:
- Endpoint:
Fn::GetAtt:
- "MyQueue1"
- "Arn"
Protocol: "sqs"
- Endpoint:
Fn::GetAtt:
- "MyQueue2"
- "Arn"
Protocol: "sqs"
topicname: "SampleTopic"
Outputs:
TopicArn:
Description: TheARN of the created SNS topic
Value: !ref MySNSTopic
topicname:
Description: Thename of the created SNS topic
Value: "SampleTopic"
See also
© Copyright notes
The copyright of the article belongs to the author, please do not reprint without permission.
Related posts
No comments...