A Step-by-Step Guide to Using HiveMQ Cloud Starter
We recently released HiveMQ Cloud Starter to address the demand for the fast and cost-effective scaling of IoT projects. HiveMQ Cloud is the first MQTT platform to provide a pay-as-you-grow solution with unlimited connections.This article series will guide IoT developers through the new offering to maximize the exciting features available in HiveMQ Cloud Starter. Here’s how to get going:
1. Sign-up for HiveMQ Cloud
If you are new to HiveMQ Cloud, it is very easy and free to sign-up. If you are an existing user, you can skip to part 2. New users can sign up via the HiveMQ Cloud webpage or HiveMQ pricing page. Choose a sign in option and provide a few details about yourself and your role.
2. Create your Starter cluster
If you are a new user you will be redirected to the “Create Cluster” tab. Existing users can select “create new cluster” on the cluster overview page.
a. Configure your cluster: The first step is to configure your cluster. This includes naming your cluster and selecting your tier and region.
- The name will be part of the cluster URL and can be used to give context to the cluster, like “production” or “staging”
- Currently the plan only offers eu-central as region, but additional regions will be announced soon
b. Add billing details: Once you’ve configured your cluster, you will be redirected to add your billing details. HiveMQ Cloud offers every new sign-up $100 in free credits upon the creation of the first cluster on Cloud Starter. These free credits are automatically applied. Your credit card is not charged until you use the free credits.
c. Now HiveMQ Cloud spins up a cluster with a dedicated broker for you.
3. Create your first credentials
MQTT credentials are authorization values (username and password) used to identify and authorize MQTT clients. They are sent to the MQTT broker during the connection process and are used to determine the client’s access rights. MQTT credentials are essential for securing MQTT client connections. Without them, anyone could connect to your MQTT broker and publish or subscribe to any topic they wanted. With credentials, you can control which clients can access your broker and what they can do once they are connected.
To get started you can create a credential with default roles and permissions. In this example, we created a credential “testuser” with default roles.
Now you are ready to send messages through an established MQTT connection. We offer 12 different options based on your language preferences and programming skills. You can find our guided onboarding by clicking the “getting started " tab. Here we cover two ways to easily send your first messages - via Web Client and via MQTT Command Line Interface (CLI).
4. Send a message using Web Client
To quickly get started and test out your credentials, you can connect to the web client using the credentials you just created in the previous step.
- a. Click on “connect client” to establish a connection. The connection status is visible on the right-hand side. The client is connected once you see “web client connected” on the screen.
- b. Subscribe to “mytopic/test” under Topic Subscriptions. We will use this test topic structure for both publishing and subscribing to messages.
- c. Publish to “mytopic/test” under Publish Message. Add “Hello World” to the message section and click on “publish”.
A table will appear below where you can see the corresponding message that you subscribe to along with the topic structure, timestamp, and the corresponding Quality of Service (QoS) level.
5. Send a message using MQTT CLI
Another way to send a message is via MQTT CLI. You can access a customized guide under the Getting Started tab.
a. Install MQTT CLI: To install MQTT CLI simply follow the steps in the guide. For this demonstration we have installed MQTT CLI on Mac. Please skip this step if MQTT CLI is already installed on your system
b. Subscribe to “mytopic/test”: We use the following to subscribe to “mytopic/test”
Please note that both the command above and the screenshot shows the unique credential name as well as the cluster name that we assigned earlier. Your customized onboarding guide will highlight the cluster name and the credentials that you create for yourself. Once you enter the command, you will be asked to enter the password for your credentials.
- c. Subscribe “mytopic/test”: Now you can publish to the same topic. To create another client and send messages to your cluster, open a second terminal window (keep your original terminal window open). In this example we use the following command to send “Hello”:
<mqtt pub -h stepbystep-7rdgup.a01.euc1.aws.hivema.cloud -p 8883 -s -u testuser -pw -t 'my/test/topic' -m 'Hello’>
The message “Hello” appears immediately in the terminal window of the second MOTT client. You can also use the Web client to subscribe and MQTT CLI to publish and vice versa.
In this step-by-step guide we detailed how to create your Starter cluster, how to create credentials, and how to send your first message. HiveMQ Cloud Starter offers a lot in terms of security features, observability, data integrations, and programmatic workflows.
In the next part, we will take a simple example and explore access credentials, roles, and permissions in detail. Stay tuned.
Sign-up now with Cloud Starter and grab $100 worth of free credits upon the creation of the first Starter cluster.
About Shashank Sharma
Shashank Sharma is a product marketing manager at HiveMQ. He is passionate about technology and enabling developer-centric workflows. He has previous experience in application software tooling, autonomous driving, and numerical computing.Contact Shashank