All Products
Search
Document Center

ApsaraMQ for MQTT:Create resources

Last Updated:Mar 11, 2026

Before you use ApsaraMQ for MQTT SDKs to send and receive messages, you must create related resources, such as instances, topics, and groups, in the ApsaraMQ for MQTT console. Each resource maps to a parameter in your client configuration.

Prerequisites

Before you begin, make sure that you have:

Step 1: Create an instance

An instance is a virtual machine that hosts your topics and groups and provides the endpoint that SDK clients connect to.

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

  2. In the top navigation bar, select a region. In the upper-left corner, click Create Instance.

  3. In the panel that appears, keep the default Subscription billing method and click OK.

  4. On the buy page, select instance specifications based on your requirements, accept the terms of service, and click Buy Now. For a comparison of available editions and their features, see Instance editions.

  5. Complete the payment on the order page.

  6. After payment, click Console to return to the ApsaraMQ for MQTT console.

Step 2: Get the instance endpoint

The endpoint is the connection URL that SDK clients use to reach the instance. You need this value when you configure messaging in code.

  1. In the ApsaraMQ for MQTT console, go to Instances and select the region where your instance is deployed.

  2. Click the instance name, or click Details in the Actions column, to open the Instance Details page.

  3. Click the Endpoints tab. Locate and copy the public endpoint.

    Endpoint

Step 3: Create a topic

A topic is the message channel that publishers and subscribers use to exchange messages. The MQTT protocol supports multi-level topics organized in a hierarchy separated by forward slashes (/).

  • Parent topics must be created in the console.

  • Subtopics are specified directly in your code and do not need to be created in the console.

Topic naming format: <parent-topic>/<level-2-topic>/<level-3-topic>

Example: SendMessage/demo/producer

The combined length of the parent topic and all subtopic levels cannot exceed 64 characters. For more details on topic structure, see Terms.

To create a parent topic:

  1. On the Instance Details page, click Topics in the left-side navigation pane.

  2. In the upper-left corner of the Topics page, click Create Topic.

  3. In the Create Topic panel, enter a Name (for example, SendMessage) and a Description, then click OK.

Step 4: Create a group

A group is used to manage your MQTT clients. For more details, see Terms.

  1. On the Instance Details page, click Groups in the left-side navigation pane.

  2. In the upper-left corner of the Groups page, click Create Group.

  3. In the Create Group panel, enter a Group ID (for example, GID_demo) and click OK.

Verify your setup

After you create the resources, confirm that the following items are ready for SDK integration:

ResourceWhere to find itUsed in SDK code as
Instance endpointInstance Details > Endpoints tabConnection URL
Parent topicInstance Details > TopicsTopic parameter in publish/subscribe calls
Group IDInstance Details > GroupsGroup ID parameter in client configuration

What to do next

With the instance, topic, and group in place, start building messaging workflows: