You can create a static username/password pair in the Message Queue for RabbitMQ console, and use the created username and password in code to access an instance from the client. This way, you no longer need to generate a dynamic username/password pair by using Message Queue for RabbitMQ SDK. This topic describes how to create a static username/password pair 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 about how to create an instance, 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 RAM user that is granted the permissions to view and create username/password pairs. 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 dynamic usernames and passwords.
  • Static username and password (recommended): Generate static usernames and passwords in the Message Queue for RabbitMQ console. This method is the same as that of open source RabbitMQ.
Notice When you call an SDK to send or receive messages on a client, we recommend that you use persistent connections. This way, you do not need to create connections every time you send or receive messages. Frequent creation of connections consumes a large number of network and server resources and may even trigger protection against SYN flood attacks. For more information, see Connection.

Usage notes

  • You can use an AccessKey pair to create only one static username/password pair in an instance. If you want to update a username/password pair, you must delete the existing pair and create a new pair. For more information, see Delete a static username/password pair.
  • If a static username/password pair is deleted or the AccessKey pair that is used to create the static username/password pair is disabled or deleted, the static username/password pair becomes invalid. When the client uses this static username/password pair 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 top navigation bar, select the region where your instance resides.
  3. In the left-side navigation pane, click Static Accounts Alerting.
  4. On the Static Accounts Alerting page, click Create Username/Password.
  5. In the Create Username/Password dialog box, specify AccessKey ID, AccessKey Secret, and Instance ID, and click OK.
    The Static Accounts Alerting page displays the created static username/password pair. By default, the password is masked.pg_Username/Password Management page
  6. Click Display in the Password column.
    The password is unmasked in the Password column.show password

Related operations

Your client can access Message Queue for RabbitMQ from an open source RabbitMQ client by using a created static username/password pair. For more information, see Overview.
Note If you use the AccessKey pair of a RAM user to create a static username/password pair 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.