Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . sns ]

create-topic

Description

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.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  create-topic
--name <value>
[--attributes <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--name (string)

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.

--attributes (map)

A map of attributes with their corresponding values.

The following lists the 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 subscriptions.
  • Policy – The policy that defines who can access your topic. By default, only the topic owner can publish or subscribe to the topic.

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

The following command creates an SNS topic named my-topic:

aws sns create-topic --name my-topic

Output:

{
    "ResponseMetadata": {
        "RequestId": "1469e8d7-1642-564e-b85d-a19b4b341f83"
    },
    "TopicArn": "arn:aws:sns:us-west-2:0123456789012:my-topic"
}

For more information, see Using the AWS Command Line Interface with Amazon SQS and Amazon SNS in the AWS Command Line Interface User Guide.

Output

TopicArn -> (string)

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