All Products
Search
Document Center

ApsaraMQ for RocketMQ:Step 2: Create resources

Last Updated:Mar 01, 2026

Before you use an SDK to send and receive messages, you must create the following resources in ApsaraMQ for RocketMQ:

  • Instance -- the managed messaging service with your chosen billing method and network configuration.

  • Topic -- the channel through which messages are sent and received.

  • Consumer group -- the logical grouping of consumers that subscribe to topics.

After creating these resources, you obtain the instance endpoint and credentials to use in your SDK code.

Prerequisites

Before you begin, complete the following tasks:

Limits

  • Regions: The ApsaraMQ for RocketMQ instance must reside in the same region as the VPC and vSwitch that you created in the "Prerequisites" section.

  • Naming conventions: For information about the naming conventions of ApsaraMQ for RocketMQ instances, topics, and consumer groups, see Quotas and limits.

  • Message types of topics: The message type of a topic must be consistent with the type of message that the topic sends and receives. For example, if you create a topic that is used to send and receive normal messages, you can use it to send and receive only normal messages. For more information, see Usage notes.

Background information

ApsaraMQ for RocketMQ allows you to create resources in the ApsaraMQ for RocketMQ console or by calling API operations. This topic describes how to create resources in the ApsaraMQ for RocketMQ console.

If you want to create resources by calling API operations, see the following topics:

Create an instance

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou).

  3. On the Instances page, click Create Instance. In the Create Message Queue for Apache RocketMQ Instance panel, set the Instance Version parameter to V5.0 and configure the Billing Method parameter. Then, click OK. ApsaraMQ for RocketMQ supports the following billing methods: For information about the billable items and scenarios of different billing methods, see Billing overview.

    Serverless ApsaraMQ for RocketMQ instances are available only in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), China (Chengdu), Singapore, Germany (Frankfurt), and US (Virginia).
    Billing methodHow you are charged
    SubscriptionAn upfront payment is required based on the computing specification and subscription duration (in months) that you select for an instance.
    Pay-as-you-goFees are post-paid based on the computing specification that you select for an instance and the actual usage duration (in hours) of the instance.
    ServerlessYou are charged based on the total number of API calls that are initiated to receive and deliver messages.
  4. On the buy page, select the specifications of the instance and click Buy Now. Then, follow the on-screen instructions to complete the payment. The following tables provide examples on how to configure the parameters on the buy page. For information about the specifications that are displayed on the buy page, see Instance selection.

    Important

    After you create an ApsaraMQ for RocketMQ instance, you cannot change the VPC or vSwitch in which the instance is deployed. If you want to change the VPC or vSwitch, you must release the instance and purchase a new instance.

Parameters configured for a serverless instance

ParameterExampleDescription
Primary EditionStandard Edition--
Billing MethodPay-by-RequestAutomatically specified.
Message Storage Capacity--You do not need to specify the storage capacity. You are charged for storage space based on the actual usage.
VPC ID*vpc-bp1cg09dua6sgh0\*\*\*\*\*\**The ID of the VPC that you created in the "Prerequisites" section of this topic.
VSwitch ID*vsw-bp1vqb0p9nz3irz\*\*\*\*\*\**The ID of the vSwitch that you created in the "Prerequisites" section of this topic. You must select two vSwitch IDs for a serverless ApsaraMQ for RocketMQ instance.
Internet AccessDisableIn this example, the client is connected to the ApsaraMQ for RocketMQ broker in a VPC. By default, Internet access is disabled. If you want to access ApsaraMQ for RocketMQ over the Internet, set this parameter to Enable.
Internal Network Metering MethodPay-by-TrafficAutomatically specified. You can access serverless ApsaraMQ for RocketMQ instances only in VPCs.
Resource GroupDefault resource groupThe resource group to which the serverless ApsaraMQ for RocketMQ instance belongs.
Security Group--The security group that you created in the "Prerequisites" section of this topic.

Parameters configured for a subscription or pay-as-you-go instance

ParameterExampleDescription
Primary EditionStandard Edition--
Sub-category EditionHigh-availability Cluster Edition (Recommended for Production Environments)--
Computing Specificationrmq.s2.2xlarge--
VPC ID*vpc-bp1cg09dua6sgh0\*\*\*\*\*\**The ID of the VPC that you created in the "Prerequisites" section of this topic.
VSwitch ID*vsw-bp1vqb0p9nz3irz\*\*\*\*\*\**The ID of the vSwitch that you created in the "Prerequisites" section of this topic.
Internet AccessDisableIn this example, the client is connected to the ApsaraMQ for RocketMQ broker in a VPC. By default, Internet access is disabled. If you want to access ApsaraMQ for RocketMQ over the Internet, set this parameter to Enable.
Resource GroupDefault resource groupThe resource group to which the ApsaraMQ for RocketMQ instance belongs.
Disk EncryptionDisableThe disk encryption feature is supported only for ApsaraMQ for RocketMQ 5.x Enterprise Platinum Edition instances.
Disk Encryption Keykey-hzz66c8207\*\*\*\*The ID of the key that is used for disk encryption in the region where the instance is deployed. This parameter is required only if you set the Disk Encryption parameter to Enable.

After the instance is created, verify that it appears on the Instances page and that its status is Running.

Create a topic

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the left-side navigation pane, click Topics. On the Topics page that appears, click Create Topic.

  3. In the Create Topic panel, enter a topic name and description, set the Message Type parameter to Normal Message, and then click OK.

After the topic is created, verify that it appears in the topic list.

Create a consumer group

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the left-side navigation pane, click Groups. On the Groups page that appears, click Create Group.

  3. In the Create Group panel, configure the Group ID parameter and click OK. You can use the default values for other parameters in the panel.

After the consumer group is created, verify that it appears in the group list.

Obtain the endpoint of an instance

You need the instance endpoint to connect your client. To obtain it:

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the TCP Endpoint section of the Instance Details page, view the endpoints of the instance.

    • VPC endpoint: The endpoint that is used to access the ApsaraMQ for RocketMQ instance in a VPC. This is the default endpoint provided by ApsaraMQ for RocketMQ.

    • Public endpoint: The endpoint that is used to access ApsaraMQ for RocketMQ over the Internet. The public endpoint is displayed only if you enable Internet access.

Obtain the username and password of an instance

In this example, Intelligent Authentication is used to describe how to obtain the username and password of an ApsaraMQ for RocketMQ instance. If you want to use access control list (ACL)-based access authentication, you must create an ACL user, grant the required permissions to the ACL user, and obtain the username and password of the ACL user. For more information, see User authentication.

When you connect a client to an ApsaraMQ for RocketMQ broker, whether to specify the username and password of the instance depends on the access method:

  • If you access the ApsaraMQ for RocketMQ broker over the Internet, you must specify the username and password of the instance.

  • If you access the ApsaraMQ for RocketMQ broker in a VPC, you need to specify the username and password only if the instance is a serverless instance and the authentication-free in VPCs feature is disabled for the instance. In other cases, the system automatically identifies the client based on the VPC endpoint that the client uses.

To obtain the credentials:

  1. On the Instances page, click the name of the instance that you want to manage.

  2. In the left-side navigation pane of the page that appears, click Access Control.

  3. Click the Intelligent Authentication tab to view the username and password of the instance.

What to do next

You have created all the resources required to send and receive messages. Proceed to the next step:

Step 3: Use an SDK to send and receive messages