ALIYUN::MNS::Topic is used to create a topic.

Syntax

{
  "Type": "ALIYUN::MNS::Topic",
  "Properties": {
    "LoggingEnabled": Boolean,
    "TopicName": String,
    "MaximumMessageSize": Integer
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
TopicNameStringYes NoThe name of the topic.The name must be unique to an Alibaba Cloud account in a region.

The name can be up to 256 characters in length and can contain letters, digits, and hyphens (-). It must start with a letter.

MaximumMessageSizeIntegerNoYesThe maximum size of a message that can be sent to the topic.

Valid values: 1024 (1 KB) to 65536 (64 KB).

Unit: bytes.

Default value: 65536 (64 KB).

LoggingEnabledBooleanNoYesSpecifies whether to enable the log management feature.Default value: false. Valid values:
  • true: enables the log management feature.
  • false: disables the log management feature.

Response parameters

Fn::GetAtt

  • TopicUrl: the URL of the created topic.
  • TopicName: the name of the created topic.
  • ARN.WithSlash: The ARN of the created topic.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      TopicName:
        Type: String
        Description: Topic name
        MinLength: 1
        MaxLength: 256
    Resources:
      Topic:
        Type: ALIYUN::MNS::Topic
        Properties:
          MaximumMessageSize: 1024
          LoggingEnabled: false
          TopicName:
            Ref: TopicName
    Outputs:
      TopicUrl:
        Description: URL of created topic
        Value:
          Fn::GetAtt:
            - Topic
            - TopicUrl
      ARN:
        Description: The ARN for ALIYUN::ROS::CustomResource
        Value:
          Fn::GetAtt:
            - Topic
            - ARN.WithSlash
      TopicName:
        Description: Topic name
        Value:
          Fn::GetAtt:
            - Topic
            - TopicName
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "TopicName": {
          "Type": "String",
          "Description": "Topic name",
          "MinLength": 1,
          "MaxLength": 256
        }
      },
      "Resources": {
        "Topic": {
          "Type": "ALIYUN::MNS::Topic",
          "Properties": {
            "MaximumMessageSize": 1024,
            "LoggingEnabled": false,
            "TopicName": {
              "Ref": "TopicName"
            }
          }
        }
      },
      "Outputs": {
        "TopicUrl": {
          "Description": "URL of created topic",
          "Value": {
            "Fn::GetAtt": [
              "Topic",
              "TopicUrl"
            ]
          }
        },
        "ARN": {
          "Description": "The ARN for ALIYUN::ROS::CustomResource",
          "Value": {
            "Fn::GetAtt": [
              "Topic",
              "ARN.WithSlash"
            ]
          }
        },
        "TopicName": {
          "Description": "Topic name",
          "Value": {
            "Fn::GetAtt": [
              "Topic",
              "TopicName"
            ]
          }
        }
      }
    }