EMQX Dedicated New Feature: Event History is available for private beta test. →

Bridging data to AWS IoT through the public network with EMQX Cloud

EMQX Cloud Team
Jul 11, 2022
Bridging data to AWS IoT through the public network with EMQX Cloud

This article will introduce how to use the EMQX Cloud data integration feature to bridge data to AWS IoT through the public network so that you can easily use AWS Lambda, Amazon Kinesis, Amazon S3, Amazon Machine Learning, Amazon DynamoDB, Amazon CloudWatch, AWS CloudTrail, and Amazon Elasticsearch Service with built-in Kibana integration to build IoT applications. Collect, process, and analyze data generated by interconnected devices without managing any infrastructure.

Introduction to AWS IoT

What is AWS IoT?

Amazon IoT Core is a hosted cloud platform that makes it easy for connected devices to securely interact with cloud applications and other devices. Amazon IoT can support billions of devices and trillions of messages and can process and securely route them to Amazon Cloud Technologies endpoint nodes and other devices. With Amazon IoT, your applications can track and communicate with all your devices at all times, even when they are not connected.

AWS IoT

Benefits of the AWS IoT platform

(1) Broad and deep: AWS has broad and deep IoT services from the edge to the cloud, providing local data collection and analysis capabilities as well as data management and rich analytics integration services on the cloud designed for IoT.

(2) Multiple layers of security: including preventive security mechanisms (such as encryption and access control of device data), continuous monitoring and auditing of security configurations, etc.

(3) Superior AI integration: AWS brings AI and IoT together to make devices smarter. Multiple machine learning frameworks are supported.

(4) Proven at scale: AWS IoT is built on a scalable, secure, and proven cloud infrastructure that scales to billions of different devices and trillions of messages.

Introduction to EMQX Cloud

EMQX Cloud is a fully managed cloud-native MQTT service from EMQ that connects to massive numbers of IoT devices and integrates with various databases and business systems.

As the world's first fully managed MQTT 5.0 public cloud service, EMQX Cloud provides a one-stop O&M colocation and a unique isolated environment for MQTT messaging services.

In the era of the Internet of Everything, EMQX Cloud can help users quickly build industry applications for the IoT field and can help users quickly build industry applications for the IoT field, and easily realize the collection, transmission, calculation, and persistence of IoT data.

EMQX Cloud is available in dozens of countries and regions around the world, providing low-cost, secure, and reliable cloud services for 5G and Internet of Everything applications, with infrastructure computing facilities provided by cloud providers.

For more information, please visit the EMQX Cloud website or view the EMQX Cloud documentation.

Bridging Data to AWS IoT with EMQX Cloud

Turn on NAT gateways

On the EMQX Cloud deployment details page, enable the value-added service, NAT Gateway, to facilitate public network access to AWS IoT.

EMQX Cloud NAT gateways

Configure AWS IoT

  1. Create a transaction

    Go to the AWS IoT control panel, find Manage - Transactions, and click Create Transaction to create a transaction named emqx.

    Create a transaction

  2. Create and download the certificate

    After creating a transaction, you can directly create a certificate.

    Create and download the certificate

    After the certificate is created, you need to download the certificate on this page for two-way authentication when the device is connected.

    download the certificate

  3. Create a policy and associate it with a certificate

    Find Security-Policy, create a policy named emqx-bridge, and write the policy with the following configuration.

    Create a policy and associate it with a certificate

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": "iot:Connect",
          "Resource": "arn:aws:iot:us-east-1:845523974165:client/emqx-bridge_*"
        },
        {
          "Effect": "Allow",
          "Action": "iot:Publish",
          "Resource": "arn:aws:iot:us-east-1:845523974165:topic/emqx/bridge"
        },
        {
          "Effect": "Allow",
          "Action": "iot:Receive",
          "Resource": "arn:aws:iot:us-east-1:845523974165:topic/emqx/bridge"
        },
        {
          "Effect": "Allow",
          "Action": "iot:RetainPublish",
          "Resource": "arn:aws:iot:us-east-1:845523974165:topic/emqx/bridge"
        },
        {
          "Effect": "Allow",
          "Action": "iot:Subscribe",
          "Resource": "arn:aws:iot:us-east-1:845523974165:topicfilter/emqx/bridge"
        }
      ]
    }
    

    After you finish creating the policy, you need to associate it with the certificate created in the previous step.

    AWS IoT

  4. Obtain the public connection address of AWS IoT

    In the settings, get the connection address endpoint for the device connection.

    AWS IoT

Configure EMQX Cloud data integration

Go to the EMQX Cloud deployment page and click Data Integration - MQTT Bridge.

EMQX Cloud data integration

Fill in the resource details for AWS IoT on the Resources page.

Fill in the resource details for AWS IoT

After confirming the resources are available, configure the rules to filter and process the data.

configure the rules

Once the rules are configured, you need to configure the response action, which is to bridge the data to AWS IoT.

configure the response action

After completing Create Resource - Add Rule - Add Action, you can view the information on the details page.

view the information

To view the created rules, click on Monitoring to see the current number of successful bridge monitoring is 0, which is the initialization status.

Monitoring

Test Verification

  1. Use the Python SDK to connect to the EMQX Cloud deployment and send messages to the topic emqx/bridge.

    connect to the EMQX Cloud

  2. Connect to AWS IoT using MQTTX, subscribe to emqx/bridge, and receive messages from the EMQX Cloud deployment.

    Connect to AWS IoT using MQTTX

    Connect to AWS IoT using MQTTX

  3. Check the rule monitoring in the EMQX Cloud console to check the success of bridging data to AWS IoT.

    Check the rule monitoring

Summary

Now we have completed the process of bridging data to AWS IoT over the public network using EMQX Cloud data integration. EMQX Cloud's flexible data integration capabilities, combined with AWS IoT's rich application ecosystem, will enable users to create an IoT application in minutes.

Try EMQX Cloud for Free
No credit card required
Get Started →

Related Posts