Menu
Amazon Simple Notification Service
API Reference (API Version 2010-03-31)

CreateTopic

Creates a topic to which notifications can be published. Users can create at most 100,000 topics. For more information, see http://aws.amazon.com/sns. 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.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

Name

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.

Type: String

Required: Yes

Response Elements

The following element is returned by the service.

TopicArn

The Amazon Resource Name (ARN) assigned to the created topic.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

AuthorizationError

Indicates that the user has been denied access to the requested resource.

HTTP Status Code: 403

InternalError

Indicates an internal service error.

HTTP Status Code: 500

InvalidParameter

Indicates that a request parameter does not comply with the associated constraints.

HTTP Status Code: 400

TopicLimitExceeded

Indicates that the customer already owns the maximum allowed number of topics.

HTTP Status Code: 403

Example

Example

Sample Request

 http://sns.us-east-1.amazonaws.com/ ?Name=My-Topic &Action=CreateTopic
        &SignatureVersion=2 &SignatureMethod=HmacSHA256
        &Timestamp=2010-03-31T12%3A00%3A00.000Z &AWSAccessKeyId=(AWS Access Key ID)
        &Signature=gfzIF53exFVdpSNb8AiwN3Lv%2FNYXh6S%2Br3yySK70oX4%3D 

Sample Response

 <CreateTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
        <CreateTopicResult>
        <TopicArn>arn:aws:sns:us-east-1:123456789012:My-Topic</TopicArn>
        </CreateTopicResult> <ResponseMetadata>
        <RequestId>a8dec8b3-33a4-11df-8963-01868b7c937a</RequestId>
        </ResponseMetadata> </CreateTopicResponse> 

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: