All Products
Search
Document Center

ApsaraMQ for RabbitMQ:CreateBinding

Last Updated:Oct 26, 2026

Creates a binding. After a producer sends a message to an exchange, the exchange routes the message to a specified queue or another exchange based on the created bindings 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 and must be the vhost to which both DestinationName and SourceExchange belong.

test

SourceExchange

string

Yes

The name of the source exchange. The 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 and belong to the same vhost as SourceExchange, which is specified by VirtualHost.

DemoQueue

BindingKey

string

No

The binding key.

  • If the source exchange is not of the topic type:

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

    • The binding key must be 1 to 255 characters in length.

  • If the source exchange is of the topic type:

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

    • The binding key cannot start or end with a period (.). If the binding key starts with a number sign (#) or an asterisk (), a period (.) must follow it. If the binding key ends with a number sign (#) or an asterisk (), a period (.) must precede it. If a number sign (#) or an asterisk (*) is in the middle of the binding key, it must be preceded and followed by a period (.).

    • The binding key must be 1 to 255 characters in length.

.test

BindingType

string

Yes

The type of the binding destination. Valid values:

  • 0: queue

  • 1: exchange

0

Argument

string

No

The key-value pairs of the message header attributes. The message header attributes are concatenated by using one or more key-value pairs. The x-match attribute is required, and other attributes are custom. Valid values of the x-match attribute:

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

  • any: At least one key-value pair of the message headers must match.

Separate attributes with semicolons (;) and separate attribute keys and values with colons (:). Example: x-match:all;type:report;format:pdf. This parameter applies only to headers exchanges and is invalid for other types of exchanges. For other types of exchanges, you can set this parameter to any value.

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

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

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.