Contents


Introduction

AWS IoT provides secure and bi-directional communication between end devices (such as sensors, actuators, embedded micro-controllers, smart appliances) and the AWS Cloud. This document will explain how to connect Milesight LoRaWAN gateway to AWS via MQTT protocol.


Requirements


  • Any Milesight LoRaWAN gateway


Configuration

AWS Configuration

Create a Thing

1. Log in AWS account. 

2. Go to Manage > All device > Things and click Create things button to create a thing.

3. Click Create a single thing and click Next.

4. Name the thing and click Next.

5. Select Auto-generate a new certificate and click Next, then you can create a policy or skip this step which we will detail on next chapter and continue to click Create thing.


6. Download all certificates.

Note:

CA certificates have an expiration date after which they cannot be used to validate a server's certificate. CA certificates are needed to be replaced after expiration date in order to ensure ongoing connectivity and to keep up to date with security best practices.

Here are all certificates for device connection:


Create Policy

1. Go to Manage > Security > Policies and click Create policy to create a policy.

2. Name the policyand add statements as shown below, then click Create to save this policy.


3. In the list of Certificates, locate the certificate you want to attach a policy, open the certificate’s option menu by choosing the ellipsis icon and choose Attach Policy.

4. Choose and attach the policy we created for gateway.

Note: Click certificates to check if correct policy and thing are attached.



Gateway Configuration

1. Connect Milesight gateway to the Internet referring to guide How to Connect Milesight Gateway to the Internet.

2. Ensure Embedded NS is enabled and go to Network Server > General to enable network server mode. 


3. Go to Network Server > Application to add an application, then add a data transmission type MQTT.

4. Fill in AWS information and import certificates, then save the configuration.

  • Broker address: It can be found on AWS web GUI >Settings > Endpoint.
  • Broker Port: 8883
  • Client ID: AWS Thing name
  • TLS mode: Self signed certificates
  • Key file: ca.pem, certificate.pem.crt, private.pem.key



Data Visualization in AWS

1. Add a Uplink data topic on Milesight gateway, then go to AWS Web GUI> Test > MQTT test client page to subscribe this uplink topic of gateway.


2. Check the details of LoRaWAN data from gateway.


 

1. Ensure the downlink data topic is set on Milesight gateway.


2. Go to AWS Web GUI> Test > MQTT test client page to publish the downlink topic of gateway and send the downlink message with JSON format as below:


Note: the downlink command must be sent with base64 format.

3. If sent successfully, you can check the downlink message from gateway.




---END---