All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MNS::Queue

Last Updated:Aug 01, 2025

ALIYUN::MNS::Queue is used to create a Simple Message Queue (formerly MNS) (SMQ) queue. A queue is a destination address where messages are stored. Queues can be classified into standard and delayed queues.

If the DelaySeconds property is not specified when messages are sent, messages that are sent to standard queues can be immediately consumed, but messages that are sent to delayed queues can be consumed only after the preset delay time.

Syntax

{
  "Type": "ALIYUN::MNS::Queue",
  "Properties": {
    "PollingWaitSeconds": Integer,
    "LoggingEnabled": Boolean,
    "MessageRetentionPeriod": Integer,
    "MaximumMessageSize": Integer,
    "DelaySeconds": Integer,
    "VisibilityTimeout": Integer,
    "QueueName": String,
    "DlqPolicy": Map,
    "Tags": List
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

QueueName

String

Yes

No

The name of the queue.

The name must be unique within 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 or digit.

DelaySeconds

Integer

No

Yes

The delay time after which all messages that are sent to the queue can be consumed.

Valid values: 0 to 604800 (7 days).

Unit: seconds.

Default value: 0.

DlqPolicy

Map

No

Yes

The dead-letter policy.

For more information, refer to DlqPolicy properties.

MaximumMessageSize

Integer

No

Yes

The maximum size of a message that can be sent to the queue.

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

Unit: bytes.

Default value: 65536 (64 KB).

MessageRetentionPeriod

Integer

No

Yes

The maximum lifetime of a message in the queue. After the time that is specified by this property expires, the message is deleted, regardless of whether the message has been consumed.

Valid values: 60 (1 minute) to 604800 (7 days).

Unit: seconds.

Default value: 345600 (4 days).

VisibilityTimeout

Integer

No

Yes

The duration for which a message stays in the Inactive state after it is consumed from the queue.

Valid values: 1 to 43200 (12 hours).

Unit: seconds.

Default value: 30.

PollingWaitSeconds

Integer

No

Yes

The maximum time period that a ReceiveMessage request can wait till a message is in the queue.

Valid values: 0 to 10.

Unit: seconds.

Default value: 0.

LoggingEnabled

Boolean

No

Yes

Specifies whether to enable the log management feature.

Valid values:

  • true

  • false (default)

Tags

List

No

Yes

The tags.

For more information, see Tags properties.

DlqPolicy syntax

"DlqPolicy": {
  "MaxReceiveCount": Integer,
  "DeadLetterTargetQueue": String,
  "Enabled": Boolean
}

DlqPolicy properties

Proeprty

Type

Required

Editable

Description

Constraint

MaxReceiveCount

Integer

Yes

Yes

The maximum number of retries.

None.

DeadLetterTargetQueue

String

Yes

Yes

The dead-letter queue to which dead-letter messages are delivered.

None.

Enabled

Boolean

Yes

Yes

Specifies whether to enable dead-letter message delivery.

None.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

None.

Value

String

Yes

No

The tag value.

None.

Return values

Fn::GetAtt

  • QueueUrl: the URL of the queue.

  • ARN.WithSlash: the Alibaba Cloud Resource Name (ARN) of the queue.

  • QueueName: the name of the queue.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
  Queue:
    Type: ALIYUN::MNS::Queue
    Properties:
      QueueName: TestQueue
      MessageRetentionPeriod: 345600
Outputs:
  QueueName:
    Description: Queue name
    Value:
      Fn::GetAtt:
        - Queue
        - QueueName
  ARN:
    Description: The ARN for ALIYUN::ROS::CustomResource
    Value:
      Fn::GetAtt:
        - Queue
        - ARN
  ARN.WithSlash:
    Description: 'The ARN: acs:mns:$region:$accountid:/queues/$queueName'
    Value:
      Fn::GetAtt:
        - Queue
        - ARN.WithSlash
  QueueUrl:
    Description: URL of created queue
    Value:
      Fn::GetAtt:
        - Queue
        - QueueUrl
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
  },
  "Resources": {
    "Queue": {
      "Type": "ALIYUN::MNS::Queue",
      "Properties": {
        "QueueName": "TestQueue",
        "MessageRetentionPeriod": 345600
      }
    }
  },
  "Outputs": {
    "QueueName": {
      "Description": "Queue name",
      "Value": {
        "Fn::GetAtt": [
          "Queue",
          "QueueName"
        ]
      }
    },
    "ARN": {
      "Description": "The ARN for ALIYUN::ROS::CustomResource",
      "Value": {
        "Fn::GetAtt": [
          "Queue",
          "ARN"
        ]
      }
    },
    "ARN.WithSlash": {
      "Description": "The ARN: acs:mns:$region:$accountid:/queues/$queueName",
      "Value": {
        "Fn::GetAtt": [
          "Queue",
          "ARN.WithSlash"
        ]
      }
    },
    "QueueUrl": {
      "Description": "URL of created queue",
      "Value": {
        "Fn::GetAtt": [
          "Queue",
          "QueueUrl"
        ]
      }
    }
  }
}

For more examples, visit subscription.yml. In the example, the ALIYUN::MNS::Topic, ALIYUN::MNS::Queue, and ALIYUN::MNS::Subscription resource types are used.