You can create a pair of static username and password in the Message Queue for RabbitMQ console. Then, you can specify the static username and password in the code of a client so that the client can access Message Queue for RabbitMQ. This topic describes how to create a pair of static username and password in the Message Queue for RabbitMQ console.

Prerequisites

  • A Message Queue for RabbitMQ instance is created and is in the Running state. For more information, see Create an instance.
  • The account that you use to log on to the Message Queue for RabbitMQ console is an Alibaba Cloud account or a Resource Access Management (RAM) user that is granted the permissions to view and create static usernames and passwords. For more information about account permissions and authorization operations, see RAM policies, Grant permissions to RAM users, and Grant permissions across Alibaba Cloud accounts.
  • The AccessKey pair of the Alibaba Cloud account or a RAM user is obtained. For more information, see Obtain an AccessKey pair.

Background information

When you access Message Queue for RabbitMQ from a client, Message Queue for RabbitMQ authenticates your permissions based on your username and password. Message Queue for RabbitMQ allows you to generate usernames and passwords for your client by using the following methods:
  • Dynamic username and password: Use a permission authentication class provided by Alibaba Cloud to generate a pair of dynamic username and password.
  • Static username and password (recommended): Generate a pair of static username and password in the Message Queue for RabbitMQ console. This method is the same as that of open source RabbitMQ.
Notice If you use an SDK to send or receive messages on your client, we recommend that you use persistent connections. This way, the client does not need to establish connections every time you use the client to send or receive messages. Frequent creation of connections consumes a large number of network and broker resources and may even trigger protection against SYN flood attacks on the broker. For more information, see Connection.

Usage notes

  • You can use an AccessKey pair to create only one pair of static username and password in an instance. If you want to update an existing pair of username and password, you must delete the existing pair and create another pair. For more information, see Delete a pair of static username and password.
  • If a pair of static username and password is deleted or the AccessKey pair used to create the pair of static username and password is disabled or deleted, the pair of static username and password becomes invalid. If a client uses this pair of static username and password to access Message Queue for RabbitMQ, the access request is rejected.

Procedure

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. On the Instances page, click the name of your instance.
  4. In the left-side navigation pane, click Static Accounts.
  5. On the Static Accounts page, click Create Username/Password.
  6. In the Create Username/Password panel, set AccessKey ID and AccessKey Secret. Then, click OK.
    On the Static Accounts page, the created pair of static username and password appears. The password is masked. Username and password
  7. In the Password column of the created pair of static username and password, click Display to view the password that corresponds to the username.

Related operations

Your client can access Message Queue for RabbitMQ from an open source RabbitMQ client by using the created pair of static username and password. For more information, see Supported SDKs.
Note If you use the AccessKey pair of a RAM user to create a pair of static username and password and use the pair to access Message Queue for RabbitMQ to send and receive messages, make sure that the RAM user is granted the permissions to send and receive messages. For more information, see RAM policies.