All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateBinding

Last Updated:Oct 23, 2025

A producer sends a message to an exchange, which then routes the message to a specified queue or another exchange based on the binding and routing rules.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

amqp:GetExchange

create

*Queue

acs:amqp:{#regionId}:{#accountId}:/instances/{#InstanceId}/vhosts/{#vhostName}/queues/*

None
  • amqp:CreateExchange
  • amqp:CreateQueue
  • amqp:GetVhost

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The ID of the ApsaraMQ for RabbitMQ instance.

amqp-cn-v0h1kb9nu***

VirtualHost

string

Yes

The name of the vhost. The vhost must be created in the console. Both DestinationName and SourceExchange must belong to this vhost.

test

SourceExchange

string

Yes

The name of the source exchange. This exchange must be created in the console.

NormalEX

DestinationName

string

Yes

The name of the binding destination. The destination must be created in the console. It must belong to the same vhost as SourceExchange. The VirtualHost parameter specifies the vhost.

DemoQueue

BindingKey

string

No

The binding key.

  • If the source exchange is not a topic exchange:

    • It can contain letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).

    • The length must be 1 to 255 characters.

  • If the source exchange is a topic exchange:

    • It can contain letters, digits, hyphens (-), underscores (_), asterisks (*), periods (.), number signs (#), forward slashes (/), and at signs (@).

    • The key cannot start or end with a period (.). If the key starts with a number sign (#) or an asterisk (*), a period (.) must immediately follow. If the key ends with a number sign (#) or an asterisk (*), a period (.) must immediately precede it. If a number sign (#) or an asterisk (*) is in the middle of the key, it must have a period (.) on both sides.

    • The length must be 1 to 255 characters.

.test

BindingType

string

Yes

The type of the destination object. Valid values:

  • 0: Queue

  • 1: Exchange

0

Argument

string

No

The key-value pairs for the message header attributes. The message header attributes consist of one or more key-value pairs. The x-match attribute is required. Other attributes are custom. The x-match attribute supports the following values:

  • all: This is the default value. All key-value pairs in the message header must match.

  • any: At least one key-value pair in the message header must match.

Separate attributes with semicolons (;) and separate keys from values with colons (:). Example: x-match:all;type:report;format:pdf This parameter is valid only for headers exchanges. For other types of exchanges, this parameter is ignored.

x-match:all;type:report;format:pdf

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

09768C14-E51C-4F4A-8077-30810032C***

Examples

Success response

JSON format

{
  "RequestId": "09768C14-E51C-4F4A-8077-30810032C***"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.