All Products
Search
Document Center

Simple Message Queue (formerly MNS):Custom policies for SMQ

Last Updated:Oct 15, 2024

If system policies do not meet your business requirements, you can create custom policies to implement the principle of least privilege. You can use custom policies to manage permissions in a fine-grained manner and improve resource access security. This topic describes the scenarios in which custom policies for Simple Message Queue (formerly MNS) are used. This topic also provides sample custom policies.

What is a custom policy?

Resource Access Management (RAM) policies are classified into system policies and custom policies. You need to maintain custom policies.

  • After you create a custom policy, you need to attach it to a RAM user, a user group, or a RAM role so that the permissions specified in the policy can be granted to the principal.

  • You can delete a RAM policy that is not attached to a principal. If the RAM policy is attached to a principal, you must detach the RAM policy from the principal before you can delete the RAM policy.

  • Custom policies support version control. You can manage custom policy versions based on the version management mechanism provided by RAM.

References

Create custom policies in the SMQ console

When you access Simple Message Queue (formerly MNS) resources in the SMQ console or by calling the SMQ API, you can create the following custom policies.

Queue management

Operation

Description

Action

Resource

ListQueue

Queries a list of queues.

mns:ListQueue

acs:mns:${regionId}:${accountId}:/queues

CreateQueue

Creates a queue.

mns:CreateQueue

acs:mns:${regionId}:${accountId}:/queues/${queueName}

DeleteQueue

Deletes a queue.

mns:DeleteQueue

GetQueueAttributes

Queries the attributes of a queue.

mns:GetQueueAttributes

SetQueueAttributes

Configures the attributes of a queue.

mns:SetQueueAttributes

Topic management

Operation

Description

Action

Resource

ListTopic

Queries a list of topics.

mns:ListTopic

acs:mns:${regionId}:${accountId}:/topics

CreateTopic

Creates a topic.

mns:CreateTopic

acs:mns:${regionId}:${accountId}:/topics/${topicName}

DeleteTopic

Deletes a topic.

mns:DeleteTopic

GetTopicAttributes

Queries the attributes of a topic.

mns:GetTopicAttributes

SetTopicAttributes

Configures the attributes of a topic.

mns:SetTopicAttributes

Subscription management

Operation

Description

Action

Resource

ListSubscriptionByTopic

Queries a list of subscriptions. If you specify a topic name, SMQ filters subscriptions based on the topic name.

mns:ListSubscriptionByTopic

acs:mns:${regionId}:${accountId}:/topics/${topicName}/subscriptions

GetSubscriptionAttributes

Queries the attributes of a subscription.

mns:GetSubscriptionAttributes

acs:mns:${regionId}:${accountId}:/topics/${topicName}/subscriptions/${subscriptionName}

SetSubscriptionAttributes

Configures the attributes of a subscription.

mns:SetSubscriptionAttributes

Subscribe

Subscribes to messages of a specific topic.

mns:Subscribe

Unsubscribe

Unsubscribes from messages of a specific topic.

mns:Unsubscribe

Sample custom policies

Create custom policies by using client SDKs

When you use client SDKs to send and receive messages, Simple Message Queue (formerly MNS) supports the following custom policies. For more information, see List of operations by function.

Queue-related messaging

Operation

Description

Action

Resource

SendMessage

Sends a message to a queue.

mns:SendMessage

acs:mns:${regionId}:${accountId}:/queues/${queueName}/messages

BatchSendMessage

Sends multiple messages to a queue at a time.

mns:SendMessage

ReceiveMessage

Receives a message from a queue.

mns:ReceiveMessage

BatchReceiveMessage

Receives multiple messages from a queue at a time.

mns:ReceiveMessage

DeleteMessage

Deletes a message that has been consumed.

mns:DeleteMessage

BatchDeleteMessage

Deletes multiple messages from a queue at a time.

mns:DeleteMessage

PeekMessage

Queries a message.

mns:PeekMessage

BatchPeekMessage

Queries multiple messages at a time.

mns:PeekMessage

ChangeMessageVisibility

Modifies the period after which a consumed message that remains in the Inactive state can be consumed again.

mns:ChangeMessageVisibility

Topic-related messaging

Operation

Description

Action

Resource

PublishMessage

Publishes a message to a specific topic.

mns:PublishMessage

acs:mns:${regionId}:${accountId}:/topics/${topicName}/messages

Sample custom policies