All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MNS::Topic

Last Updated:Jun 04, 2025

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

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

TopicName

String

Yes

No

The 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.

MaximumMessageSize

Integer

No

Yes

The 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).

LoggingEnabled

Boolean

No

Yes

Specifies whether to enable the log management feature.

Default value: false. Valid values:

  • true: enables the log management feature.

  • false: disables the log management feature.

Tags

List

No

No

The tags of the topic.

For more information, see the "Tags properties" section of this topic.

Tags syntax

"Tags": [{
  "Key": String,
  "Value": String
}]

Tags properties

Property

Type

Requried

Editable

Description

Constraint

Key

String

Yes

No

The key of the tag.

None.

Value

String

No

No

The value of the tag.

None.

Return values

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

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
{
  "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"
        ]
      }
    }
  }
}