Skip to content

AWS::SNS::Topic

The AWS::SNS::Topic resource creates a topic to which notifications can be published.

Generated by cfn-typegen --out cfn_types AWS::SNS::Topic into cfn_types/sns.py:

# Generated by cfn-typegen from the CloudFormation registry schemas. Do not edit.
# fmt: off
# ruff: noqa
"""AWS::SNS resources."""

from collections.abc import Mapping, Sequence
from typing import Any, Literal, NotRequired, Unpack
from typing_extensions import TypedDict
from cfn_typed.base import DeletionPolicy, DependsOn, ResourceAttrs, Tag, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr


CONSTRAINTS:dict[str,Any]={
'AWS::SNS::Topic':{'MaximumMessageSize':{'m':1024,'M':1048576},'DeliveryStatusLogging':{'T':{'P':{'Protocol':{'e':["http/s","sqs","lambda","firehose","application"]}}}}},
}


ATTRIBUTES:dict[str,Any]={"AWS::SNS::Topic":["TopicArn"]}


RULES:dict[str,Any]={}
Nested types (5)

These are defined above the properties in the generated module.

class TopicSubscription(TypedDict, closed=True):
    '``Subscription`` is an embedded property that describes the subscription endpoints of an SNS topic.'
    Endpoint: Expr[str]
    'The endpoint that receives notifications from the SNS topic.'
    Protocol: Expr[str]
    "The subscription's protocol."


class TopicLoggingConfig(TypedDict, closed=True):
    'The ``LoggingConfig`` property type specifies the ``Delivery`` status logging configuration for an [AWS::SNS::Topic](https://docs.aws.amazon.com/AWSCloudForm...'
    Protocol: Expr[str]
    'Indicates one of the supported protocols for the Amazon SNS topic.'
    SuccessFeedbackRoleArn: NotRequired[Expr[str]]
    'The IAM role ARN to be used when logging successful message deliveries in Amazon CloudWatch.'
    SuccessFeedbackSampleRate: NotRequired[Expr[str]]
    'The percentage of successful message deliveries to be logged in Amazon CloudWatch.'
    FailureFeedbackRoleArn: NotRequired[Expr[str]]
    'The IAM role ARN to be used when logging failed message deliveries in Amazon CloudWatch.'


class TopicProps(TypedDict, closed=True):
    'The ``AWS::SNS::Topic`` resource creates a topic to which notifications can be published.'
    DisplayName: NotRequired[Expr[str]]
    'The display name to use for an SNS topic with SMS subscriptions.'
    KmsMasterKeyId: NotRequired[Expr[str]]
    'The ID of an AWS managed customer master key (CMK) for SNS or a custom CMK.'
    DataProtectionPolicy: NotRequired[Expr[Mapping[str, Any]]]
    'The body of the policy document you want to use for this topic.'
    Subscription: NotRequired[Expr[Sequence[Expr[TopicSubscription]]]]
    'The SNS subscriptions (endpoints) for this topic.'
    FifoTopic: NotRequired[Expr[bool]]
    'Set to true to create a FIFO topic.'
    ContentBasedDeduplication: NotRequired[Expr[bool]]
    '``ContentBasedDeduplication`` enables deduplication of messages based on their content for FIFO topics.'
    ArchivePolicy: NotRequired[Expr[Mapping[str, Any]]]
    'The ``ArchivePolicy`` determines the number of days SNS retains messages in FIFO topics.'
    FifoThroughputScope: NotRequired[Expr[str]]
    'Specifies the throughput quota and deduplication behavior to apply for the FIFO topic.'
    MaximumMessageSize: NotRequired[Expr[int]]
    'The maximum payload size, in bytes, for messages published to the topic.'
    Tags: NotRequired[Expr[Sequence[Expr[Tag]]]]
    'The list of tags to add to a new topic.'
    TopicName: NotRequired[Expr[str]]
    'The name of the topic you want to create.'
    SignatureVersion: NotRequired[Expr[str]]
    'The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe...'
    TracingConfig: NotRequired[Expr[str]]
    'Tracing mode of an SNS topic.'
    DeliveryStatusLogging: NotRequired[Expr[Sequence[Expr[TopicLoggingConfig]]]]
    'The ``DeliveryStatusLogging`` configuration enables you to log the delivery status of messages sent from your Amazon SNS topic to subscribed endpoints with t...'


class Topic(ResourceAttrs):
    'The ``AWS::SNS::Topic`` resource creates a topic to which notifications can be published.'
    Type: Literal['AWS::SNS::Topic']
    Properties: NotRequired[TopicProps]


def topic(
    *,
    depends_on: DependsOn | None = None,
    deletion_policy: DeletionPolicy | None = None,
    update_replace_policy: UpdateReplacePolicy | None = None,
    condition: str | None = None,
    metadata: dict[str, Any] | None = None,
    **props: Unpack[TopicProps],
) -> Topic:
    return build('AWS::SNS::Topic', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)

Attributes

Read-only values for get_att(logical_id, attribute). They are not accepted as inputs.

  • TopicArn