aws服务器不能联网_在AWS上进行物联网分析入门

本文介绍了如何在面临AWS服务器联网问题时,依然能够开始进行物联网数据分析。通过解决服务器连接问题,读者可以逐步入门AWS上的物联网分析。
摘要由CSDN通过智能技术生成

aws服务器不能联网

介绍 (Introduction)

AWS defines AWS IoT as a set of managed services that enable ‘internet-connected devices to connect to the AWS Cloud and lets applications in the cloud interact with internet-connected devices.’ AWS IoT services span three categories: Device Software, Connectivity and Control, and Analytics. In this post, we will focus on AWS IoT Analytics, one of four services, which are part of the AWS IoT Analytics category. According to AWS, AWS IoT Analytics is a fully-managed IoT analytics service, designed specifically for IoT, which collects, pre-processes, enriches, stores, and analyzes IoT device data at scale.

AWS将AWS IoT定义为一组托管服务,这些服务使“与Internet相连的设备能够连接到AWS Cloud,并使云中的应用程序与与Internet相连的设备进行交互”。 AWS IoT服务涵盖三类:设备软件,连接和控制以及分析。 在本文中,我们将重点介绍AWS IoT Analytics ,这是AWS IoT Analytics类别中的四个服务之一。 根据AWS的说法,AWS IoT Analytics是一项完全托管的IoT分析服务,专为IoT设计,可大规模收集,预处理,充实,存储和分析IoT设备数据。

Certainly, AWS IoT Analytics is not the only way to analyze the Internet of Things (IoT) or Industrial Internet of Things (IIoT) data on AWS. It is common to see Data Analyst teams using a more general AWS data analytics stack, composed of Amazon S3, Amazon Kinesis, AWS Glue, and Amazon Athena or Amazon Redshift and Redshift Spectrum, for analyzing IoT data. So then why choose AWS IoT Analytics over a more traditional AWS data analytics stack? According to AWS, IoT Analytics was purpose-built to manage the complexities of IoT and IIoT data on a petabyte-scale. According to AWS, IoT data frequently has significant gaps, corrupted messages, and false readings that must be cleaned up before analysis can occur. Additionally, IoT data must often be enriched and transformed to be meaningful. IoT Analytics can filter, transform, and enrich IoT data before storing it in a time-series data store for analysis.

当然,AWS IoT Analytics不是分析AWS上的物联网 (IoT)或工业物联网 (IIoT)数据的唯一方法。 常见的情况是,数据分析师团队使用由Amazon S3Amazon KinesisAWS GlueAmazon AthenaAmazon RedshiftRedshift Spectrum组成的更通用的AWS数据分析堆栈来分析IoT数据。 那么,为什么要在更传统的AWS数据分析堆栈上选择AWS IoT Analytics ? 据AWS称,物联网分析是专门为管理PB级的IoT和IIoT数据而设计的。 根据AWS的说法,物联网数据经常存在巨大的差距,损坏的消息和错误的读数,必须先清除这些错误才能进行分析。 此外,物联网数据通常必须丰富并转化为有意义的。 物联网分析可以过滤,转换和丰富物联网数据,然后再将其存储在时序数据存储中进行分析。

In the following post, we will explore the use of AWS IoT Analytics to analyze environmental sensor data, in near real-time, from a series of IoT devices. To follow along with the post’s demonstration, there is an option to use sample data to simulate the IoT devices (see the ‘Simulating IoT Device Messages’ section of this post).

在以下文章中,我们将探索使用AWS IoT Analytics来从一系列IoT设备近实时地分析环境传感器数据。 为了跟随该帖子的演示,可以选择使用示例数据来模拟IoT设备(请参阅本文的“ 模拟IoT设备消息 ”部分)。

物联网设备 (IoT Devices)

In this post, we will explore IoT Analytics using IoT data generated from a series of custom-built environmental sensor arrays. Each breadboard-based sensor array is connected to a Raspberry Pi single-board computer (SBC), the popular, low cost, credit-card sized Linux computer. The IoT devices were purposely placed in physical locations that vary in temperature, humidity, and other environmental conditions.

在本文中,我们将使用从一系列定制环境传感器阵列生成的物联网数据探索物联网分析。 每个基于面包板的传感器阵列都连接到Raspberry Pi单板计算机(SBC),这是一种流行的,低成本,信用卡大小的Linux计算机。 物联网设备专门放置在温度,湿度和其他环境条件不同的物理位置。

Image for post
Raspberry Pi devices with sensor arrays used in the demonstration
演示中使用的具有传感器阵列的Raspberry Pi设备

Each device includes the following sensors:

每个设备都包含以下传感器:

  1. MQ135 Air Quality Sensor Hazardous Gas Detection Sensor: CO, LPG, Smoke (link)

    MQ135空气质量传感器有害气体检测传感器:CO,LPG,烟雾( 链接 )

    (requires an MCP3008–8-Channel 10-Bit ADC w/ SPI Interface (

    (需要带有SPI接口的MCP3008–8通道10位ADC(

    link))

    链接 ))

  2. DHT22/AM2302 Digital Temperature and Humidity Sensor (link)

    DHT22 / AM2302数字温湿度传感器( 链接 )

  3. Onyehn IR Pyroelectric Infrared PIR Motion Sensor (link)

    Onyehn红外热释电红外PIR运动传感器( 链接 )

  4. Anmbest Light Intensity Detection Photosensitive Sensor (link)

    最大光强度检测光敏传感器( 链接 )

Image for post
Detailed view of breadboard-based environment sensor array used in the demonstration
演示中使用的基于面包板的环境传感器阵列的详细视图

AWS IoT设备SDK (AWS IoT Device SDK)

Each Raspberry Pi device runs a custom Python script, sensor_collector_v2.py. The script uses the AWS IoT Device SDK for Python v2 to communicate with AWS. The script collects a total of seven different readings from the four sensors at a regular interval. Sensor readings include temperature, humidity, carbon monoxide (CO), liquid petroleum gas (LPG), smoke, light, and motion.

每个Raspberry Pi设备运行一个自定义的Python脚本sensor_collector_v2.py 。 该脚本使用适用于Python v2AWS IoT设备SDK与AWS进行通信。 该脚本以固定的时间间隔从四个传感器收集总共七个不同的读数。 传感器读数包括温度,湿度,一氧化碳(CO),液化石油气(LPG),烟,光和运动。

The script securely publishes the sensor readings, along with a device ID and timestamp, as a single message, to AWS using the ISO standard Message Queuing Telemetry Transport (MQTT) network protocol. Below is an example of an MQTT message payload, published by the collector script.

该脚本使用ISO标准消息队列遥测传输 (MQTT)网络协议将传感器读数以及设备ID和时间戳作为单个消息安全地发布到AWS。 以下是收集器脚本发布的MQTT消息有效负载的示例。

As shown below, using tcpdump on the IoT device, the MQTT message payloads generated by the script average approximately 275 bytes. The complete MQTT messages average around 300 bytes.

如下所示,使用IoT设备上的tcpdump ,脚本生成的MQTT消息有效负载平均约为275个字节。 完整的MQTT消息平均大约300个字节。

Image for post

AWS IoT核心 (AWS IoT Core)

Each Raspberry Pi is registered with AWS IoT Core. IoT Core allows users to quickly and securely connect devices to AWS. According to AWS, IoT Core can reliably scale to billions of devices and trillions of messages. Registered devices are referred to as things in AWS IoT Core. A thing is a representation of a specific device or logical entity. Information about a thing is stored in the registry as JSON data.

每个Raspberry Pi 均已AWS IoT Core注册。 IoT Core允许用户快速安全地将设备连接到AWS。 根据AWS的说法,IoT Core可以可靠地扩展到数十亿个设备和数万亿条消息。 已注册的设备在AWS IoT Core中称为事物事物是特定设备或逻辑实体的表示。 有关事物的信息作为JSON数据存储在注册表中。

IoT Core provides a Device Gateway, which manages all active device connections. The Gateway currently supports MQTT, WebSockets, and HTTP 1.1 protocols. Behind the Message Gateway is a high-throughput pub/sub Message Broker, which securely transmits messages to and from all IoT devices and applications with low latency. Below, we see a typical AWS IoT Core architecture.

IoT Core提供了一个设备网关 ,该网关管理所有活动的设备连接。 网关当前支持MQTT,WebSocket和HTTP 1.1协议。 Message Gateway的背后是高吞吐量的pub / sub Message Broker ,它以低延迟安全地与所有IoT设备和应用程序之间来回传输消息。 在下面,我们看到了典型的AWS IoT核心架构。

Image for post

At a message frequency of five seconds, the three Raspberry Pi devices publish a total of roughly 50,000 IoT messages per day to AWS IoT Core.

三个Raspberry Pi设备以五秒钟的消息频率,每天总共向AWS IoT Core发布约50,000条IoT消息。

Image for post

AWS IoT安全性 (AWS IoT Security)

AWS IoT Core provides mutual authentication and encryption, ensuring all data is exchanged between AWS and the devices are secure by default. In the demo, all data is sent securely using Transport Layer Security (TLS) 1.2 with X.509 digital certificates on port 443. Authorization of the device to access any resource on AWS is controlled by individual AWS IoT Core Policies, similar to AWS IAM Policies. Below, we see an example of an X.509 certificate, assigned to a registered device.

AWS IoT Core提供了相互身份验证和加密,确保默认情况下在AWS之间交换所有数据并且设备是安全的 。 在演示中,所有数据都使用传输层安全性 (TLS)1.2和端口443上的X.509数字证书安全地发送。设备访问AWS上任何资源的授权均由单独的AWS IoT核心策略控制 ,类似于AWS IAM政策。 下面,我们看到一个分配给已注册设备的X.509证书的示例。

Image for post

AWS IoT核心规则 (AWS IoT Core Rules)

Once an MQTT message is received from an IoT device (a thing), we use AWS IoT Rules to send message data to an AWS IoT Analytics Channel. Rules give your devices the ability to interact with AWS services. Rules are written in standard Structured Query Language (SQL). Rules are analyzed, and Actions are performed based on the MQTT topic stream. Below, we see an example rule that forwards our messages to IoT Analytics, in addition to AWS IoT Events and Amazon Kinesis Data Firehose.

从物联网设备( 事物 )接收到MQTT消息后,我们将使用AWS IoT规则将消息数据发送到AWS IoT Analytics Channel 。 规则使您的设备能够与AWS服务进行交互。 规则以标准结构化查询语言(SQL)编写。 分析规则,并根据MQTT主题流执行操作 。 在下面,我们看到一个示例规则,除了AWS IoT事件和Amazon Kinesis Data Firehose之外,还可以将消息转发到IoT Analytics。

Image for post

模拟物联网设备消息 (Simulating IoT Device Messages)

Building and configuring multiple Raspberry Pi-based sensor arrays, and registering the devices with AWS IoT Core would require a lot of work just for this post. Therefore, I have provided everything you need to simulate the three IoT devices, on GitHub. Use the following command to git clone a local copy of the project.

构建和配置多个基于Raspberry Pi的传感器阵列,并向AWS IoT Core注册设备,仅此篇文章就需要大量工作。 因此,我在GitHub上提供了模拟三个IoT设备所需的一切。 使用以下命令git clone项目的本地副本。

AWS CloudFormation (AWS CloudFormation)

Use the CloudFormation template, iot-analytics.yaml, to create an IoT Analytics stack containing (17) resources, including the following.

使用CloudFormation模板iot-analytics.yaml来创建包含(17)个资源的IoT Analytics堆栈,包括以下资源。

  • (3) AWS IoT Things

    (3)AWS IoT事物
  • (1) AWS IoT Core Topic Rule

    (1)AWS IoT核心主题规则
  • (1) AWS IoT Analytics Channel, Pipeline, Data store, and Data set

    (1)AWS IoT分析通道,管道,数据存储和数据集
  • (1) AWS Lambda and Lambda Permission

    (1)AWS Lambda和Lambda权限
  • (1) Amazon S3 Bucket

    (1)亚马逊S3桶
  • (1) Amazon SageMaker Notebook Instance

    (1)Amazon SageMaker笔记本实例
  • (5) AWS IAM Roles

    (5)AWS IAM角色

Please be aware of the costs involved with the AWS resources used in the CloudFormation template before continuing. To build the AWS CloudFormation stack, run the following AWS CLI command.

在继续之前,请注意CloudFormation模板中使用的AWS资源涉及的成本。 要构建AWS CloudFormation堆栈,请运行以下AWS CLI命令。

Below, we see a successful deployment of the IoT Analytics Demo CloudFormation Stack.

在下面,我们看到IoT Analytics Demo CloudFormation Stack的成功部署。

Image for post

发布样本消息 (Publishing Sample Messages)

Once the CloudFormation stack is created successfully, use an included Python script, send_sample_messages.py, to send sample IoT data to an AWS IoT Topic, from your local machine. The script will use your AWS identity and credentials, instead of an actual IoT device registered with IoT Core. The IoT data will be intercepted by an IoT Topic Rule and redirected, using a Topic Rule Action, to the IoT Analytics Channel.

成功创建CloudFormation堆栈后,请使用随附的Python脚本send_sample_messages.py从本地计算机将示例IoT数据发送到AWS IoT主题。 该脚本将使用您的AWS身份和凭证,而不是在IoT Core中注册的实际IoT设备。 IoT主题规则将拦截IoT数据,并使用主题规则操作将其重定向到IoT分析渠道。

First, we will ensure the IoT stack is running correctly on AWS by sending a few test messages. Go to the AWS IoT Core Test tab. Subscribe to the iot-device-data topic.

首先,我们将通过发送一些测试消息来确保IoT堆栈在AWS上正确运行。 转到AWS IoT Core测试选项卡。 订阅“物iot-device-data主题。

Image for post

Then, run the following command using the smaller data file, raw_data_small.json.

然后,使用较小的数据文件raw_data_small.json运行以下命令。

If successful, you should see the five messages appear in the Test tab, shown above. Example output from the script is shown below.

如果成功,您应该看到上面显示的“测试”选项卡中出现了五则消息。 脚本的示例输出如下所示。

Image for post

Then, run the second command using the larger data file, raw_data_large.json, containing 9,995 messages (a few hours worth of data). The command will take approximately 12 minutes to complete.

然后,使用较大的数据文件raw_data_large.json运行第二个命令,该文件包含9,995条消息(价值几个小时的数据)。 该命令大约需要12分钟才能完成。

Once the second command completes successfully, your IoT Analytics Channel should contain 10,000 unique messages. There is an optional extra-large data file containing approximately 50,000 IoT messages (24 hours of IoT messages).

一旦第二条命令成功完成,您的IoT Analytics Channel应该包含10,000条唯一消息。 有一个可选的超大数据文件,其中包含大约50,000个IoT消息(24小时IoT消息)。

AWS IoT分析 (AWS IoT Analytics)

AWS IoT Analytics is composed of five primary components: Channels, Pipelines, Data stores, Data sets, and Notebooks. These components enable you to collect, prepare, store, analyze, and visualize your IoT data.

AWS IoT Analytics由五个主要组件组成:通道,管道,数据存储,数据集和笔记本。 这些组件使您可以收集,准备,存储,分析和可视化IoT数据。

Image for post

Below, we see a typical AWS IoT Analytics architecture. IoT messages are pulled from AWS IoT Core, thought a Rule Action. Amazon QuickSight provides business intelligence, visualization. Amazon QuickSight ML Insights adds anomaly detection and forecasting.

在下面,我们看到了典型的AWS IoT Analytics架构。 IoT消息是从AWS IoT Core中提取的,这是规则操作。 Amazon QuickSight提供商业智能,可视化。 Amazon QuickSight ML Insights添加了异常检测和预测。

Image for post
Typical AWS IoT Analytics architecture
典型的AWS IoT分析架构

物联网分析频道 (IoT Analytics Channel)

An AWS IoT Analytics Channel pulls messages or data into IoT Analytics from other AWS sources, such as Amazon S3, Amazon Kinesis, or Amazon IoT Core. Channels store data for IoT Analytics Pipelines. Both Channels and Data store support storing data in your own Amazon S3 bucket or in an IoT Analytics service-managed S3 bucket. In the demonstration, we are using a service managed S3 bucket.

AWS IoT Analytics Channel将消息或数据从其他AWS来源(例如Amazon S3,Amazon Kinesis或Amazon IoT Core)拉入IoT Analytics。 通道存储物联网分析管道的数据。 渠道和数据存储都支持将数据存储在您自己的Amazon S3存储桶中或IoT Analytics Service管理的S3存储桶中。 在演示中,我们使用服务管理的S3存储桶。

When creating a Channel, you also decide how long to retain the data. For the demonstration, we have set the data retention period for 14 days. Typically, you would only retain data in the Channel for the time period you need to analyze. For long term storage of IoT message data, I recommend using an AWS IoT Core Rule to send a copy of the raw IoT data to Amazon S3, using a service such as Amazon Kinesis Data Firehose.

创建通道时,您还可以决定将数据保留多长时间。 对于演示,我们将数据保留期设置为14天。 通常,您只会在需要分析的时间段内保留通道中的数据。 对于IoT消息数据的长期存储,我建议使用AWS IoT核心规则,通过Amazon Kinesis Data Firehose之类的服务将原始IoT数据的副本发送到Amazon S3。

Image for post

物联网分析管道 (IoT Analytics Pipeline)

An AWS IoT Analytics Pipeline consumes messages from one or more Channels. Pipelines transform, filter, and enrich the messages before storing them in IoT Analytics Data stores. A Pipeline is composed of an array of activities. Logically, you must specify both a Channel (source) and a Datastore (destination) activity. Optionally, you may choose as many as 23 additional activities in the pipelineActivities array.

AWS IoT Analytics Pipeline使用来自一个或多个渠道的消息。 在将消息存储在IoT Analytics数据存储中之前,管道会对其进行转换,过滤和丰富。 管道由一系列活动组成。 从逻辑上讲,您必须同时指定Channel ( )和Datastore ( 目的地 )活动。 (可选)您可以在pipelineActivities数组中选择多达23个其他活动。

In our demonstration’s Pipeline, iot_analytics_pipeline, we have specified five additional activities, including DeviceRegistryEnrich, Filter, Math, Lambda, and SelectAttributes. There are two additional Activity types we did not choose, RemoveAttributes and AddAttributes.

在演示的管道iot_analytics_pipeline ,我们指定了五个其他活动,包括DeviceRegistryEnrichFilterMathLambdaSelectAttributes 。 我们没有选择其他两种Activity类型, RemoveAttributesAddAttributes

Image for post

The demonstration’s Pipeline created by CloudFormation starts with messages from the demonstration’s Channel, iot_analytics_channel, similar to the following.

iot_analytics_channel创建的演示的管道以来自演示的通道iot_analytics_channel消息开始,类似于以下内容。

The demonstration’s Pipeline transforms the messages through a series of Pipeline Activities and then stores the resulting message in the demonstration’s Data store, iot_analytics_data_store. The resulting messages appear similar to the following.

演示的管道通过一系列管道活动转换消息,然后将结果消息存储在演示的数据存储iot_analytics_data_store 。 产生的消息类似于以下内容。

In our demonstration, transformations to the messages include dropping the device_id attribute and converting the temp attribute value to Fahrenheit. In addition, the Lambda Activity rounds down the temp, humidity, co, lpg, and smoke attribute values to between 2–4 decimal places of precision.

在我们的演示中,对消息的转换包括删除device_id属性并将temp属性值转换为Fahrenheit。 此外, Lambda活动将temphumiditycolpgsmoke属性值四舍五入到2-4个小数位精度之间。

Image for post

The demonstration’s Pipeline also enriched the message with the metadata attribute, containing metadata from the IoT device’s AWS IoT Core Registry. The metadata includes additional information about the device that generated the message, including custom attributes we input, such as location (longitude and latitude) and the device’s installation date.

演示的管道还通过metadata属性丰富了消息,其中包含来自IoT设备的AWS IoT Core Registry的元数据。 元数据包括有关生成消息的设备的其他信息,包括我们输入的自定义属性,例如位置(经度和纬度)和设备的安装日期。

Image for post

A significant feature of Pipelines is the ability to reprocess messages. If you make a change to the Pipeline, which often happens during the data preparation stage, you can reprocess any or all messages in the associated Channel, and overwrite the messages in the Data set.

管道的重要功能是能够重新处理消息。 如果对管道进行更改(通常在数据准备阶段进行),则可以重新处理关联通道中的任何或所有消息,并覆盖数据集中的消息。

Image for post

物联网分析数据存储 (IoT Analytics Data store)

An AWS IoT Analytics Data store stores prepared data from an AWS IoT Analytics Pipeline, in a fully-managed database. Both Channels and Data store support storing data in your own Amazon S3 bucket or in an IoT Analytics managed S3 bucket. In the demonstration, we are using a service-managed S3 bucket to store messages in our Data store.

AWS IoT Analytics数据存储区将来自AWS IoT Analytics Pipeline的准备数据存储在完全托管的数据库中。 渠道和数据存储都支持将数据存储在您自己的Amazon S3存储桶或IoT Analytics管理的S3存储桶中。 在演示中,我们使用服务管理的S3存储桶将消息存储在数据存储中。

Image for post

物联网分析数据集 (IoT Analytics Data set)

An AWS IoT Analytics Data set automatically provides regular, up-to-date insights for data analysts by querying a Data store using standard SQL. Regular updates are provided through the use of a cron expression. For the demonstration, we are using a 15-minute interval.

通过使用标准SQL查询数据存储,AWS IoT Analytics数据集自动为数据分析人员提供常规的最新见解。 通过使用cron表达式提供定期更新。 对于演示,我们使用15分钟的间隔。

Below, we see the sample messages in the Result preview pane of the Data set. These are the five test messages we sent to check the stack. Note the SQL query used to obtain the messages, which queries the Data store. The Data store, as you will recall, contains the transformed messages from the Pipeline.

在下面,我们在数据集的“结果”预览窗格中看到示例消息。 这是我们发送来检查堆栈的五条测试消息。 请注意用于获取消息SQL查询,该查询查询数据存储。 您会记得,数据存储包含来自管道的转换后的消息。

Image for post

IoT Analytics Data sets also support sending content results, which are materialized views of your IoT Analytics data, to an Amazon S3 bucket.

IoT Analytics数据集还支持将内容结果(是IoT Analytics数据的物化视图)发送到Amazon S3存储桶。

Image for post

The CloudFormation stack contains an encrypted Amazon S3 Bucket. This bucket receives a copy of the messages from the IoT Analytics Data set whenever the scheduled update is run by the cron expression.

CloudFormation堆栈包含一个加密的Amazon S3存储桶。 每当由cron表达式运行计划的更新时,此存储桶就会从IoT Analytics数据集中接收消息的副本。

Image for post

物联网分析笔记本 (IoT Analytics Notebook)

An AWS IoT Analytics Notebook allows users to perform statistical analysis and machine learning on IoT Analytics Data sets using Jupyter Notebooks. The IoT Analytics Notebook service includes a set of notebook templates that contain AWS-authored machine learning models and visualizations. Notebooks Instances can be linked to a GitHub or other source code repository. Notebooks created with IoT Analytics Notebook can also be accessed directly through Amazon SageMaker. For the demonstration, the Notebooks Instance is associated with the project’s GitHub repository.

AWS IoT Analytics Notebook允许用户使用Jupyter Notebook对IoT Analytics数据集执行统计分析和机器学习。 IoT Analytics Notebook服务包括一组笔记本模板,其中包含AWS授权的机器学习模型和可视化。 笔记本实例可以链接到GitHub或其他源代码存储库。 也可以通过Amazon SageMaker直接访问使用IoT Analytics Notebook创建的笔记本。 为了进行演示,Notebooks实例与项目的GitHub存储库相关联。

Image for post

The repository contains a sample Jupyter Notebook, IoT_Analytics_Demo_Notebook.ipynb, based on the conda_python3 kernel. This preinstalled environment includes the default Anaconda installation and Python 3. The Notebook uses pandas, matplotlib, and plotly to manipulate and visualize the sample IoT messages we published earlier and stored in the Data set.

该库包含样本Jupyter笔记本, IoT_Analytics_Demo_Notebook.ipynb的基础上, conda_python3内核。 该预安装的环境包括默认的Anaconda安装和Python3。Notebook使用pandas,matplotlib和plotly来操纵和可视化我们之前发布并存储在数据集中的示例IoT消息。

Image for post
Image for post
Image for post
Image for post

Notebooks can be modified, and the changes pushed back to GitHub. You could easily fork a copy of my GitHub repository and modify the CloudFormation template, to include your own GitHub repository URL.

可以修改笔记本,并将更改推回GitHub。 您可以轻松派生我的GitHub存储库的副本并修改CloudFormation模板,以包括您自己的GitHub存储库URL。

Image for post

亚马逊QuickSight (Amazon QuickSight)

Amazon QuickSight provides business intelligence (BI) and visualization. Amazon QuickSight ML Insights adds anomaly detection and forecasting. We can use Amazon QuickSight to visualize the IoT message data, stored in the IoT Analytics Data set.

Amazon QuickSight提供商业智能(BI)和可视化。 Amazon QuickSight ML Insights添加了异常检测和预测。 我们可以使用Amazon QuickSight可视化存储在IoT Analytics数据集中的IoT消息数据。

Amazon QuickSight has both a Standard and an Enterprise Edition. AWS provides a detailed product comparison of each edition. For the post, I am demonstrating the Enterprise Edition, which includes additional features, such as ML Insights, hourly refreshes of SPICE (super-fast, parallel, in-memory, calculation engine), and theme customization. Please be aware of the costs of Amazon QuickSight if you choose to follow along with this part of the demo. Amazon QuickSight is enabled or configured with the demonstration’s CloudFormation template.

Amazon QuickSight具有标准版和企业版。 AWS提供了每个版本的详细产品比较 。 在这篇文章中,我将演示企业版,其中包括其他功能 ,例如ML Insights,每小时更新一次SPICE (超快速,并行,内存中,计算引擎)以及主题自定义。 如果您选择跟随演示的此部分,请注意Amazon QuickSight的费用。 Amazon QuickSight已通过演示的CloudFormation模板启用或配置。

QuickSight数据集 (QuickSight Data Set)

Amazon QuickSight has a wide variety of data source options for creating Amazon QuickSight Data sets, including the ones shown below. Do not confuse Amazon QuickSight Data sets with IoT Analytics Data sets. These are two different, yet similar, constructs.

Amazon QuickSight具有用于创建Amazon QuickSight数据集的多种数据源选项,包括以下所示的那些。 不要将Amazon QuickSight数据集与IoT Analytics数据集混淆。 这是两个不同但又相似的结构。

Image for post

For the demonstration, we will create an Amazon QuickSight Data set that will use our IoT Analytics Data set as a data source.

在演示中,我们将创建一个Amazon QuickSight数据集,该数据集将使用IoT Analytics数据集作为数据源。

Image for post

Amazon QuickSight gives you the ability to modify QuickSight Data sets. For the demonstration, I have added two additional fields, converting the boolean light and motion values of true and false to binary values of 0 or 1. I have also deselected two fields that I do not need for QuickSight Analysis.

Amazon QuickSight使您能够修改QuickSight数据集。 在演示中,我添加了两个附加字段,将true和false的布尔light motion值转换为0或1的二进制值。我还取消选择了QuickSight Analysis不需要的两个字段。

Image for post

QuickSight provides a wide variety of functions, enabling us to perform dynamic calculations on the field values. Below, we see a new calculated field, light_dec, containing the original light field’s Boolean values converted to binary values. I am using a if...else formula to change the field's value depending on the value in another field.

QuickSight提供了多种功能,使我们能够对字段值执行动态计算。 在下面,我们看到一个新的计算字段light_dec ,其中包含原始光字段的布尔值(转换为二进制值)。 我正在使用if...else公式来更改字段的值,具体取决于另一个字段中的值。

Image for post

QuickSight分析 (QuickSight Analysis)

Using the QuickSight Data set, built from the IoT Analytics Data set as a data source, we create a QuickSight Analysis. The QuickSight Analysis user interface is shown below. An Analysis is primarily a collection of Visuals (Visual types). QuickSight provides a number of Visual types. Each visual is associated with a Data set. Data for the QuickSight Analysis or for each individual visual can be filtered. For the demo, I have created a QuickSight Analysis, including several typical QuickSight Visuals.

使用从IoT分析数据集构建的QuickSight数据集作为数据源,我们创建了QuickSight分析。 QuickSight Analysis用户界面如下所示。 分析主要是视觉(视觉类型)的集合。 QuickSight提供了许多可视类型 。 每个视觉都与一个数据集相关联。 可以过滤QuickSight Analysis或每个单独的视觉数据。 对于该演示,我创建了一个QuickSight分析,包括几种典型的QuickSight视觉效果。

Image for post

QuickSight仪表板 (QuickSight Dashboard)

To share a QuickSight Analysis, we can create a QuickSight Dashboard. Below, we see a few views of the QuickSight Analysis, shown above, as a Dashboard. A viewer of the Dashboard cannot edit the visuals, though they can apply filtering and interactively drill-down into data in the Visuals.

要共享QuickSight分析,我们可以创建一个QuickSight仪表板。 在下面,我们以仪表板的形式显示了QuickSight分析的一些视图,如上所示。 仪表板的查看器无法编辑视觉效果,尽管他们可以应用筛选并以交互方式向下钻取视觉效果中的数据。

Image for post
Image for post
Image for post

地理空间数据 (Geospatial Data)

Amazon QuickSight understands geospatial data. If you recall, in the IoT Analytics Pipeline, we enriched the messages in the metadata from the device registry. The metadata attributes contained the device’s longitude and latitude. Quicksight will recognize those fields as geographic fields. In our QuickSight Analysis, we can visualize the geospatial data, using the geospatial chart (map) Visual type.

Amazon QuickSight可以了解地理空间数据 。 您还记得吗,在IoT Analytics(分析)管道中,我们通过设备注册表丰富了元数据中的消息。 元数据属性包含设备的经度和纬度。 Quicksight会将这些字段识别为地理字段。 在我们的QuickSight分析中,我们可以使用地理空间图表 (地图)可视化类型来可视化地理空间数据。

Image for post

QuickSight移动应用 (QuickSight Mobile App)

Amazon QuickSight offers free iOS and Android versions of the Amazon QuickSight Mobile App. The mobile application makes it easy for registered QuickSight end-users to securely connect to QuickSight Dashboards, using their mobile devices. Below, we see two views of the same Dashboard, shown in the iOS version of the Amazon QuickSight Mobile App.

Amazon QuickSight提供了Amazon QuickSight移动应用程序的免费iOS和Android版本。 移动应用程序使注册QuickSight最终用户可以轻松地使用其移动设备安全地连接到QuickSight仪表板。 在下面,我们看到同一仪表板的两个视图,在Amazon QuickSight Mobile App的iOS版本中显示。

Image for post
Dashboard view from Amazon QuickSight Mobile App
Amazon QuickSight Mobile App的仪表板视图

Amazon QuickSight ML见解 (Amazon QuickSight ML Insights)

According to Amazon, ML Insights leverages AWS’s machine learning (ML) and natural language capabilities to gain deeper insights from data. QuickSight’s ML-powered Anomaly Detection continuously analyze data to discover anomalies and variations inside of the aggregates, giving you the insights to act when business changes occur. QuickSight’s ML-powered Forecasting can be used to accurately predict your business metrics, and perform interactive what-if analysis with point-and-click simplicity. QuickSight’s built-in algorithms make it easy for anyone to use ML that learns from your data patterns to provide you with accurate predictions based on historical trends.

根据Amazon的说法,ML Insights利用AWS的机器学习(ML)和自然语言功能从数据中获得更深入的见解。 QuickSight的基于ML的异常检测功能不断分析数据,以发现聚合中的异常和变化,从而使您获得洞察力,以在业务发生变化时采取行动。 QuickSight的基于ML的预测功能可用于准确地预测您的业务指标,并通过单击即可简单地进行交互式假设分析。 QuickSight的内置算法使任何人都可以轻松使用从您的数据模式中学习的ML,从而根据历史趋势为您提供准确的预测。

Below, we see the ML Insights tab in the demonstration’s QuickSight Analysis. Individually detected anomalies can be added to the QuickSight Analysis, similar to Visuals, and configured to tune the detection parameters.

下面,我们在演示的QuickSight分析中看到ML Insights选项卡。 可以将单独检测到的异常添加到QuickSight Analysis中,类似于Visuals,并配置为调整检测参数

Image for post

Below, we see an example of humidity anomalies across all devices, based on their Anomaly Score and are higher or lower with a minimum delta of five percent.

下面,我们将根据所有设备的异常得分,查看所有设备上的湿度异常的示例,湿度异常的高低均在5%左右。

Image for post

打扫干净 (Cleaning Up)

You are charged hourly for the SageMaker Notebook Instance. Do not forget to delete your CloudFormation stack when you are done with the demonstration. Note the Amazon S3 bucket will not be deleted; you must do this manually.

SageMaker Notebook实例每小时收费一次。 完成演示后,请不要忘记删除CloudFormation堆栈。 请注意,Amazon S3存储桶不会被删除; 您必须手动执行此操作。

结论 (Conclusion)

In this post, we demonstrated how to use AWS IoT Analytics to analyze and visualize streaming messages from multiple IoT devices, in near real-time. Combined with other AWS IoT analytics services, such as AWS IoT SiteWise, AWS IoT Events, and AWS IoT Things Graph, you can create a robust, full-featured IoT Analytics platform, capable of handling millions of industrial, commercial, and residential IoT devices, generating petabytes of data.

在本文中,我们演示了如何使用AWS IoT Analytics来近实时地分析和可视化来自多个IoT设备的流消息。 结合其他AWS IoT分析服务(例如AWS IoT SiteWiseAWS IoT EventsAWS IoT Things Graph) ,您可以创建一个强大的功能齐全的IoT Analytics平台,能够处理数百万个工业,商业和住宅IoT设备,生成PB的数据。

This blog represents my own viewpoints and not of my employer, Amazon Web Services.

该博客代表了我自己的观点,而不代表我的雇主Amazon Web Services。

翻译自: https://towardsdatascience.com/getting-started-with-iot-analytics-on-aws-5f2093bcf704

aws服务器不能联网

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值