---
title: "MQTT Client | AWS Example | N3uron KB V1.22"
slug: "mqtt-client-aws-example"
description: "MQTT Client is a N3uron module designed to connect to any MQTT broker in order to send and receive tag events. Mqtt Client implements a bidirectional…"
updated: 2025-09-30T15:55:31Z
published: 2025-12-23T10:03:05Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.n3uron.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Example

## Amazon Web Services

[Embedded content](https://www.youtube.com/embed/ZyQnaVFID64?&amp;wmode=opaque&amp;rel=0)

### Configuring AWS

First, log into the log into [](https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fconsole.aws.amazon.com%2Fiot%2Fhome%3Fstate%3DhashArgs%2523%26isauthcode%3Dtrue&amp;client_id=arn%3Aaws%3Aiam%3A%3A015428540659%3Auser%2Ficebreaker&amp;forceMobileApp=0&amp;code_challenge=ETidpEjR8IfnBgSfYu92dWZ9UnWZ9PngKb4wIkO-4HM&amp;code_challenge_method=SHA-256)[Amazon](https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fconsole.aws.amazon.com%2Fiot%2Fhome%3Fstate%3DhashArgs%2523%26isauthcode%3Dtrue&amp;client_id=arn%3Aaws%3Aiam%3A%3A015428540659%3Auser%2Ficebreaker&amp;forceMobileApp=0&amp;code_challenge=ETidpEjR8IfnBgSfYu92dWZ9UnWZ9PngKb4wIkO-4HM&amp;code_challenge_method=SHA-256)[](https://signin.aws.amazon.com/signin?redirect_uri=https%3A%2F%2Fconsole.aws.amazon.com%2Fiot%2Fhome%3Fstate%3DhashArgs%2523%26isauthcode%3Dtrue&amp;client_id=arn%3Aaws%3Aiam%3A%3A015428540659%3Auser%2Ficebreaker&amp;forceMobileApp=0&amp;code_challenge=ETidpEjR8IfnBgSfYu92dWZ9UnWZ9PngKb4wIkO-4HM&amp;code_challenge_method=SHA-256) and Open AWS IoT Console.

![Figure 74- AWS IoT Console](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2074-%20AWS%20IoT%20Console.png)

Once logged in, you’ll create the AWS IoT resources that a device will require to connect to AWS IoT and exchange messages.

#### Create a Policy using the AWS IoT Console

This policy will authorize your device to interact with AWS IoT services.

- **Step 1:** Within the [](https://console.aws.amazon.com/iot/home)[AWS IoT Console](https://console.aws.amazon.com/iot/home)[](https://console.aws.amazon.com/iot/home), in the left-hand menu, first select **Secure,** and then **Policies**. On the **You don't have a policy yet** page, choose **Create a policy**. If your account has existing policies, choose **Create**.
- **Step 2:** On the **Create a Policy** page,
  - In the **Name** field, enter a name for the policy (for example, N3uron_Policy).
  - In the **Action** field, enter iot:Connect, iot:Receive, iot:Publish, iot:Subscribe.
  - In the **Resource ARN** field, enter *.
  - Select the **Allow** check box.
- **Step 3:** After you have entered the information for your policy, choose **Create**.

For more information, see [](https://docs.aws.amazon.com/iot/latest/developerguide/iam-policies.html)[IAM Policies](https://docs.aws.amazon.com/iot/latest/developerguide/iam-policies.html)[](https://docs.aws.amazon.com/iot/latest/developerguide/iam-policies.html).

![Figure 75- Create Policy panel in the AMazon IoT platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2075-%20Create%20Policy%20panel%20in%20the%20AMazon%20IoT%20platform.png)

#### Create Things Objects in the AWS IoT Console

Devices connected to AWS IoT are represented by Thing objects in the AWS IoT registry. A Thing object represents a specific device or logical entity.

- **Step 1:** Within the [](https://console.aws.amazon.com/iot/home)[AWS IoT Console](https://console.aws.amazon.com/iot/home)[](https://console.aws.amazon.com/iot/home), in the left-hand menu, select **Manage**, then choose **Things**.
- **Step 2:** On the **Things** page, select **Create Things**.
- **Step 3:** On the **Create Things** page, select **Create a single thing**, then select **Next**.

![Figure 76- Create things in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2076-%20Create%20things%20in%20the%20Amazon%20IoT%20Platform.png)

- **Step 4:** On the **Specify thing properties** page, for **Thing name**, enter a name for your Thing. In this example, we have named it “****N3uron_Gateway**”**.
- **Step 5:** Leave the rest of the fields on this page empty. Select **Next**.

![Figure 77- Specify Thing properties panel in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2077-%20Specify%20Thing%20properties%20panel%20in%20the%20Amazon%20IoT%20Platform.png)

- **Step 6:** On the **Configure device certificate – optional** page, select **Auto-generate a new certificate (recommended)**. Select **Next**.

![Figure 78- Configure device certificate panel inf the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2078-%20Configure%20device%20certificate%20panel%20inf%20the%20Amazon%20IoT%20Platform.png)

- **Step 7:** On the **Attach policies to certificate – optional** page, select the policy you created in the previous section. In this case, ****N3uron_Policy****. Choose **Create thing**.

![Figure 79- Attach policies panel in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2079-%20Attach%20policies%20panel%20in%20the%20Amazon%20IoT%20Platform.png)

- **Step 8:******On the **Download certificates and keys****page**,
  - Download each of the certificates and key files and save them for later. You'll need to install these files on your device. See below for the required files:
    - Private key
    - Public key
    - Device certificate
    - Root CA certificate
  - Download the **Amazon root CA 1**.
  - Choose **Done**.

![Figure 80- Download certificates and keys window in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2080-%20Download%20certificates%20and%20keys%20window%20in%20the%20Amazon%20IoT%20Platform.png)

After this procedure is complete, you should be able to see the new thing object in your list of Things.

Click on the Thing you’ve just created, N3uron_Gateway, select the **Certificates** tab, and make sure the certificate is active.

![Figure 81- Thing Details Panel in Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2081-%20Thing%20Details%20Panel%20in%20Amazon%20IoT%20Platform.png)

### Start Configuring N3uron IIoT Platform

#### **Create a Module Instance Within N3uron's WebUI Interface**

- **Step 1:** In the **Navigation** panel, select **Config**.
- **Step 2:** In the **Explorer** panel, select **Modules**.
- **Step 3:** Click on the **Model**menu and select **New Module**.
- **Step 4:** The instance can be given any name but for the example we will use MQTT.
- **Step 5:** Set the **Module Type** property to MqttClient. Leave the rest of the properties as their default values and click **Save**.

![Figure 82- How to create an instance using N3uron's MQTT Module panel](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2082-%20How%20to%20create%20an%20instance%20using%20N3uron's%20MQTT%20Module%20panel.png)

#### **Configure N3uron's MQTT Module within the WebUI's Explorer Panel**

- **Step 1:** In the **Explorer** panel, select the MQTT instance you have just created.
- **Step 2:** Click on the Model menu bottom bar and select **New Connection**.
- **Step 3:** Give the New connection a name. In this example, it has been named AWS.
- **Step 4:** Configure the connection properties:
  - Select **Amazon Web Services** from the **Destination Broker** drop-down menu.
  - Load the **Certificate**, **Private key,** and **CA certificate** you downloaded and saved when you created the Thing in the AWS IoT Console.
  - In the [](https://console.aws.amazon.com/iot/home)[AWS IoT Console](https://console.aws.amazon.com/iot/home)[](https://console.aws.amazon.com/iot/home), in the left-hand menu, go to **Settings** and copy your **Device Data Endpoint**. Go back to N3uron and paste it into the **Broker URL** field.
  - Leave the rest of the properties as their default values and click on **Save**.

![Figure 83- Endpoint in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2083-%20Endpoint%20in%20the%20Amazon%20IoT%20Platform.png)

![AWS_Example](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/AWS_Example.png)

### Publishing & Subscribing Data via N3uron and Amazon Web Services

#### **Publish Data Using N3uron's MQTT Module**

- **Step 1:** Within the **Model** panel, right-click on the AWS Connection you have just configured, select **New Publisher,** and give it a name. In this example, we will simply use Publisher.
- **Step 2:** Click on it and add a name in the **Topic**field. In this example, we have used N3uron.
- **Step 3:** Click on the **Tag Filter** button, select **New Tag Filter,** and change the default name. In this example, we have used **Filter**. Leave **Mode**, **Path,** and **Regex patterns** as their default values.

With this configuration, every tag configured in N3uron will be published to our AWS Broker.

![AWS_ExamplePub](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/AWS_ExamplePub.png)

- **Step 4:** In the **Explorer panel,** select **Tags**.
- **Step 5:** In the **Model** menu, right-click on the folder icon, select **New Tag,** and give it a name. In this example, we will use Process_value.
- **Step 6:** Within the **Configuration** panel, set the following properties using the values shown below, leaving the rest of them as their default values:
  - **Type**: Number.
  - **Simulation/Enabled**: Yes

![Figure 86- Tag configuration settings in N3uron's MQTT module panel](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2086-%20Tag%20configuration%20settings%20in%20N3uron's%20MQTT%20module%20panel.png)

- **Step 7:** Go to the [](https://console.aws.amazon.com/iot/home)[AWS IoT Console](https://console.aws.amazon.com/iot/home)[](https://console.aws.amazon.com/iot/home) and in the left-hand menu, select **MQTT test client**.
- **Step 8:** Click on the **Subscribe to a Topic** tab, enter # in the **Topic filter** to subscribe to everything, and click on **Subscribe**. Within a few seconds, you should see the messages published to the N3uron/Process_Value topic that corresponds to our previous configuration.

![Figure 87- MQTT Test client in the Amazon IoT Platform](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2087-%20MQTT%20Test%20client%20in%20the%20Amazon%20IoT%20Platform.png)

#### **Subscribe to a Topic Using N3uron's MQTT Module**

- **Step 1:** In the **Model** panel, right-click on the AWS Connection, select **New Subscriber,** and give it a name. In this example, we will simply use Subscriber.
- **Step 2:** Click on it and add a name in the **Topic**field. In this example, we have used Test2.
- **Step 3:** Set the following properties using the values shown below, leaving the rest of them as their default values:
  - **Qos**: Qos 0.
  - **Encoding**: UTF8
  - **Compression**: None
  - **Serialization**: JSON
  - **Data parser/Type**: MqttClient JSON

![Figure - AWS Subscriber](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20AWS%20Subscriber.png)

- **Step 4:** Within the **Explorer panel,** select **Tags**.
- **Step 5:** In the **Model** menu, right-click on the folder icon, select **New Tag,** and give it a name. In this example, we will use Subscribed_value.
- **Step 6:**In the **Configuration** panel, set the following properties using the values shown below, leaving the rest of them as their default values:
  - **Type**: Number
  - **Source/Enabled**: Yes
  - **Module Type**: MqttClient
  - **Module name**:****MQTT
  - **Config/Subscriber**: AWS/Subscriber
- **Step 7:** Click on **Save.**

![Figure 89- Subscribed tag configuration settings in N3uron's WebUI interface](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2089-%20Subscribed%20tag%20configuration%20settings%20in%20N3uron's%20WebUI%20interface.png)

- **Step 8:** Go to the [](https://console.aws.amazon.com/iot/home)[AWS IoT Console](https://console.aws.amazon.com/iot/home)[](https://console.aws.amazon.com/iot/home) and in the left-hand menu select **MQTT test client**.
- **Step 9:** Click on the **Publish to a topic** tab, enter Test2****in the **Topic filter****,**and enter the following in******Message Payload**:

```actionscript
{
    "/Subscribed_value": [{
        "v": 3.14159,
        "q": 192,
        "ts": 1630668488618
    }]
}
```

- **Step 10:** Click on the **Publish** button.
- **Step 11:** Go back to the **N3uron WebUI interface** and in the left-hand panel, select **Data/Real Time**. You should now see the Subscribed_Value tag you created before with a value of 3.14159.

![Figure 90- Real-time values in N3uron's WebUI interface](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2090-%20Real-time%20values%20in%20N3uron's%20WebUI%20interface.png)

#### **Create a Writer Using N3uron's MQTT Module**

Note:From **N3uron**version**1.21.3**, the **Writer**is deprecated.

Writers are similar to Subscribers, the main difference between them being that Writers issue a write command to the underlying data provider for a specific tag, while a Subscriber acts directly as a data provider.

- **Step 1:** Within the **Model** panel, right-click on the AWS Connection, select **New Writer,** and give it a name. In this example, we will simply use Writer.
- **Step 2:** Click on it and add a name in the **Topic**field. In this example, we have used Test.
- **Step 3:** Set the following properties using the values shown below, leaving the rest of them as their default values:
  - **Qos**: QoS 0.
  - **Serialization**: JSON
  - **Data Structure**: Compact
  - **Compression**: None
  - **Encoding**: UTF8
- **Step 4:** Click on the **Tag Filter** button, select **New Tag Filter,** and change the default name. In this example, we have used Filter.
- **Step 5:** Enter /Setpoint****in the **Path** field and leave **Mode** & **Regex pattern** as their default values.

![Figure 91- Writer configuration settings in N3uron's MQTT module panel](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2091-%20Writer%20configuration%20settings%20in%20N3uron's%20MQTT%20module%20panel.png)

- **Step 6:**Within the **Explorer panel**, select **Tags**.
- **Step 7:** In the **Model** menu, right-click on the folder icon, select **New Tag,** and give it a name. In this example, we will use Setpoint.
- **Step 8:** In the **Configuration** panel, set the following properties using the values shown below, leaving the rest of them as their default values:
  - **Type**: Number.
  - **Source/Enabled**: No
  - **Client access**: Read/Write
- **Step 9:**Click on **Save.**

![Figure 92-Writer tag configuration settings in N3uron's WebUI interface](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%2092-Writer%20tag%20configuration%20settings%20in%20N3uron's%20WebUI%20interface.png)

- **Step 1:** Go to the [AWS IoT Console](https://console.aws.amazon.com/iot/home) and in the left-hand menu, select **MQTT test client**.
- **Step 2:** Click on the **Publish to a topic** tab, enter Test****in the **Topic filter**, and enter the following in the******Message Payload**:

```actionscript
{
    "/Setpoint": 25.8
}
```

- **Step 3:** Click on the **Publish** button.
- **Step 4:** Go back to the **N3uron WebUI interface** and in the left-hand panel, select **Data/Real Time**. You should now see the Setpoint tag you created before with a value of 25.8.

[MQTT Client Full Product Details](https://n3uron.com/iiot-platform-modules/mqtt-client/)
