Skip to content

SNSClient.create_topic

rboto-sns==0.4.0 · Service index · Types

Model summary (excerpt): Creates a topic to which notifications can be published. Users can create at most 100,000 standard topics (at most 1,000 FIFO topics). For more information, see Creating an Amazon SNS topic in the Amazon SNS Developer Guide . This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.

Install and imports

python -m pip install "rboto[sns]==0.4.0"
from rboto import SNSClient
from collections.abc import Sequence
from rboto_sns.types import (
    CreateTopicOutput,
    Tag,
)

Signature

async def create_topic(
    *,
    name: str,
    attributes: dict[str, str] | None = None,
    tags: Sequence[Tag] | None = None,
    data_protection_policy: str | None = None,
) -> CreateTopicOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
name Yes The name of the topic you want to create. Constraints: Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. For a FIFO (first-in-first-out) topic, the name must end with the .fifo suffix.
attributes No A map of attributes with their corresponding values. The following lists names, descriptions, and values of the special request parameters that the CreateTopic action uses: DeliveryPolicy – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints. DisplayName – The display name to use for a topic with SMS, email , and email-json subscriptions. For email and...
tags No 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 and sns:TagResource permissions.
data_protection_policy No Amazon SNS message data protection is no longer available to new customers. For more information and guidance on alternatives, see Amazon SNS message data protection availability change . 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.

Output

CreateTopicOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
topic_arn str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

CreateTopicOutput, Tag

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_sns.exceptions:

AuthorizationError, ConcurrentAccessError, InternalError, InvalidParameterError, InvalidSecurityError, StaleTagError, TagLimitExceededError, TagPolicyError, TopicLimitExceededError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model