当前位置:网站首页>将 EMQX Cloud 数据通过公网桥接到 AWS IoT
将 EMQX Cloud 数据通过公网桥接到 AWS IoT
2022-07-02 21:35:00 【51CTO】
在物联网业务场景中,往往涉及对海量物联设备产生数据的实时提取、过滤、分拆、转换等。EMQ 推出的全托管云原生 MQTT 消息服务 EMQX Cloud 提供了高性能的内置数据集成功能,可以帮助用户实现与各种云服务(如 Kafka、MongoDB、AWS RDS、AWS DocumentDB、 AWS IoT 等)的连接,将物联网数据根据需求转存到各类第三方数据库、消息队列、数据系统中,从而简化物联网应用开发,加速业务交付。
本文将介绍如何使用 EMQX Cloud 数据集成功能通过公网桥接数据到 AWS IoT,从而借助 AWS IoT 轻松使用 AWS Lambda、Amazon Kinesis、Amazon S3、Amazon Machine Learning、Amazon DynamoDB、Amazon CloudWatch、AWS CloudTrail 和内置 Kibana 集成的 Amazon Elasticsearch Service 等 AWS 服务构建 IoT 应用程序。无需管理任何基础设施,即可实现对互连设备生成数据的收集、处理和分析等相关操作。
AWS IoT 简介
什么是 AWS IoT
Amazon IoT Core 是一种托管的云平台,让互联设备可以轻松安全地与云应用程序和其他设备交互。Amazon IoT 可以支持数十亿台设备和数万亿条消息,并能处理这些消息并将其安全可靠地路由至亚马逊云科技终端节点和其他设备。借助 Amazon IoT,您的应用程序可以随时跟踪您的所有设备并与其通信,即使这些设备未处于连接状态也不例外。
AWS IoT
AWS IoT 平台的优势
(1)广泛而深入:AWS 拥有从边缘到云端的广泛而深入的 IoT 服务,提供本地数据收集和分析能力以及云上专为 IoT 设计的数据管理和丰富分析集成服务。
(2)多层安全性:包括预防性安全机制(如设备数据的加密和访问控制)、持续监控和审核安全配置等。
(3)卓越的 AI 集成:AWS 将 AI 和 IoT 结合在一起,使设备更为智能化。支持多种机器学习框架。
(4)大规模得到验证:AWS IoT 构建于可扩展、安全且经过验证的云基础设施之上,可扩展到数十亿种不同的设备和数万亿条消息。
使用 EMQX Cloud 桥接数据到 AWS IoT
开通 NAT 网关
在 EMQX Cloud 部署详情页面,开通增值服务 —- NAT 网关,便于公网访问到 AWS IoT。
EMQX Cloud 开通 NET 网关
配置 AWS IoT
创建事务
进入 AWS IoT 控制面板,找到管理-事务,点击创建事务,即可创建一个名为 emqx 的事务。
AWS IoT 创建事务
创建并下载证书
在创建好事务以后,可直接创建一个证书。
AWS IoT 创建并下载证书
证书创建完成以后,需要在该页面下载证书,用于设备连接时的双向认证。
AWS IoT 下载证书
创建策略并关联到证书
找到安全-策略,创建名为 emqx-bridge 的策略,编写策略,相关配置如下。
创建策略
{
"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"
}
]
}
完成策略创建以后,需要关联到前一步创建好的证书。
关联到证书
获取 AWS IoT 的公网连接地址
在设置获取到连接地址 endpoint,用于设备连接。
获取 AWS IoT 的公网连接地址
配置 EMQX Cloud 数据集成
进入 EMQX Cloud 的部署页面,点击数据集成 - MQTT Bridge。
配置 EMQX Cloud 数据集成
在资源页面填写 AWS IoT 的资源详细信息。
填写 AWS IoT 的资源详细信息
确认资源可用以后,进行规则配置,筛选并处理数据。
规则配置
配置好规则以后,需要配置响应动作,即桥接数据到 AWS IoT。
配置响应动作
在完成创建资源 - 添加规则 - 添加动作以后,可在详情页面查看相关信息。
查看详情
查看已创建的规则,点击监控,可查看到目前桥接成功监控次数为 0,即初始化状态。
查看桥接成功监控次数
测试验证
使用 Python SDK 连接到 EMQX Cloud 部署,向主题 emqx/bridge 发送消息。
向主题 emqx bridge 发送消息
使用 MQTTX 连接到 AWS IoT,订阅 emqx/bridge,可以接收到来自 EMQX Cloud 部署的消息。
使用 MQTTX 连接到 AWS IoT
使用 MQTTX 连接到 AWS IoT1
在 EMQX Cloud console 查看规则监控,可以检查桥接数据到 AWS IoT 成功与否。
查看规则监控
结语
至此,我们完成了使用 EMQX Cloud 数据集成功能通过公网桥接数据到 AWS IoT 的全部流程。EMQX Cloud 灵活的数据集成功能,结合 AWS IoT 丰富的应用生态,用户在数分钟内即可创建一款物联网应用。
边栏推荐
- MySQL learning record (6)
- #include<>和#include“”的区别
- Research Report on market supply and demand and strategy of microplate instrument industry in China
- VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
- Introduction to victoriametrics
- ~90z axis translation
- Etcd Raft 协议
- The failure rate is as high as 80%. What should we do about digital transformation?
- 【零基础一】Navicat下载链接
- *C language final course design * -- address book management system (complete project + source code + detailed notes)
猜你喜欢

Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale

Gee: (II) resampling the image

如何访问kubernetes API?

Gbase8s database type
![[shutter] shutter layout component (wrap component | expanded component)](/img/a7/824a990235fc5ce67841ebdcf001fb.jpg)
[shutter] shutter layout component (wrap component | expanded component)

【零基础一】Navicat下载链接

Basic IO interface technology - microcomputer Chapter 7 Notes

How to prevent your jar from being decompiled?

Five message formats of OSPF

MySQL learning record (5)
随机推荐
Construction and maintenance of business website [1]
Today, I met a Alipay and took out 35K. It's really sandpaper to wipe my ass. it's a show for me
GEE:(二)对影像进行重采样
Image segmentation using pixellib
Research Report on minimally invasive medical robot industry - market status analysis and development prospect prediction
[shutter] shutter page Jump (route | navigator | page close)
[shutter] shutter layout component (opacity component | clipprect component | padding component)
[sword finger offer] 56 - I. the number of numbers in the array
[Jianzhi offer] 56 - ii Number of occurrences of numbers in the array II
在beforeDestroy中销毁localStorage中的值无效
From "bronze" to "King", there are three secrets of enterprise digitalization
2019 Nanchang (relive the classic)
tinymce可视化编辑器增加百度地图插件
Three chess games
Market trend report, technical dynamic innovation and market forecast of China's low gloss instrument
100 important knowledge points that SQL must master: using cursors
How to center the positioned text horizontally and vertically
[Jianzhi offer] 57 And are two numbers of S
D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
Pip install whl file Error: Error: … Ce n'est pas une roue supportée sur cette plateforme