AWS::IoTAnalytics::Pipeline - AWS CloudFormation
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

AWS::IoTAnalytics::Pipeline

AWS::IoTAnalytics::Pipeline 资源使用来自一个或多个通道的消息,并允许您在将消息存储到数据存储之前处理这些消息。您必须同时指定 channeldatastore 活动,以及 pipelineActivities 数组中的最多 23 个额外的活动(可选)。有关更多信息,请参阅 AWS IoT Analytics 用户指南 中的如何使用 AWS IoT Analytics

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

{ "Type" : "AWS::IoTAnalytics::Pipeline", "Properties" : { "PipelineActivities" : [ Activity, ... ], "PipelineName" : String, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::IoTAnalytics::Pipeline Properties: PipelineActivities: - Activity PipelineName: String Tags: - Tag

属性

PipelineActivities

“PipelineActivity”对象的列表。活动可对您的消息执行转换,例如删除、重命名或添加消息属性;根据属性值筛选消息;对消息调用您的 Lambda 函数以进行高级处理;或者执行数学变换以使设备数据标准化。

该列表可能包含 2-25 个 PipelineActivity 对象,并且必须同时包含 channeldatastore 活动。该列表中的每个条目必须仅包含一个活动,例如:

pipelineActivities = [ { "channel": { ... } }, { "lambda": { ... } }, ... ]

必需:是

类型Activity 的列表

最高25

Update requires: No interruption

PipelineName

管道的名称。

必需:否

类型:字符串

最低1

最高128

模式^[a-zA-Z0-9_]+$

Update requires: Replacement

Tags

可用于管理管道的元数据。

有关更多信息,请参阅标签

必需:否

类型Tag 的列表

最高50

Update requires: No interruption

示例

简单管道

以下示例创建一个简单管道。

JSON

{ "Description": "Create a simple Pipeline", "Resources": { "Pipeline": { "Type": "AWS::IoTAnalytics::Pipeline", "Properties": { "PipelineName": "SimplePipeline", "PipelineActivities": [ { "Channel": { "Name": "ChannelActivity", "ChannelName": "SimpleChannel", "Next": "DatastoreActivity" }, "Datastore": { "Name": "DatastoreActivity", "DatastoreName": "SimpleDatastore" } } ] } } } }

YAML

--- Description: "Create a simple Pipeline" Resources: Pipeline: Type: "AWS::IoTAnalytics::Pipeline" Properties: PipelineName: "SimplePipeline" PipelineActivities: - Channel: Name: "ChannelActivity" ChannelName: "SimpleChannel" Next: "DatastoreActivity" Datastore: Name: "DatastoreActivity" DatastoreName: "SimpleDatastore"

复杂管道

以下示例创建一个复杂管道。

JSON

{ "Description": "Create a complex Pipeline", "Resources": { "Pipeline": { "Type": "AWS::IoTAnalytics::Pipeline", "Properties": { "PipelineName": "ComplexPipeline", "PipelineActivities": [ { "Channel": { "Name": "ChannelActivity", "ChannelName": "Channel", "Next": "LambdaActivity" }, "Lambda": { "Name": "LambdaActivity", "LambdaName": "Lambda", "BatchSize": 1, "Next": "AddAttributesActivity" }, "AddAttributes": { "Name": "AddAttributesActivity", "Attributes": { "key1": "attribute1", "key2": "attribute2" }, "Next": "RemoveAttributesActivity" }, "RemoveAttributes": { "Name": "RemoveAttributesActivity", "Attributes": [ "attribute1", "attribute2" ], "Next": "SelectAttributesActivity" }, "SelectAttributes": { "Name": "SelectAttributesActivity", "Attributes": [ "attribute1", "attribute2" ], "Next": "FilterActivity" }, "Filter": { "Name": "FilterActivity", "Filter": "attribute1 > 40 AND attribute2 < 20", "Next": "MathActivity" }, "Math": { "Name": "MathActivity", "Attribute": "attribute", "Math": "attribute - 10", "Next": "DeviceRegistryEnrichActivity" }, "DeviceRegistryEnrich": { "Name": "DeviceRegistryEnrichActivity", "Attribute": "attribute", "ThingName": "thingName", "RoleArn": "arn:aws:iam::<your_Account_Id>:role/Enrich", "Next": "DeviceShadowEnrichActivity" }, "DeviceShadowEnrich": { "Name": "DeviceShadowEnrichActivity", "Attribute": "attribute", "ThingName": "thingName", "RoleArn": "arn:aws:iam::<your_Account_Id>:role/Enrich", "Next": "DatastoreActivity" }, "Datastore": { "Name": "DatastoreActivity", "DatastoreName": "Datastore" } } ] } } } }

YAML

--- Description: "Create a complex Pipeline" Resources: Pipeline: Type: "AWS::IoTAnalytics::Pipeline" Properties: PipelineName: "ComplexPipeline" PipelineActivities: - Channel: Name: "ChannelActivity" ChannelName: "Channel" Next: "LambdaActivity" Lambda: Name: "LambdaActivity" LambdaName: "Lambda" BatchSize: 1 Next: "AddAttributesActivity" AddAttributes: Name: "AddAttributesActivity" Attributes: key1: "attribute1" key2: "attribute2" Next: "RemoveAttributesActivity" RemoveAttributes: Name: "RemoveAttributesActivity" Attributes: - "attribute1" - "attribute2" Next: "SelectAttributesActivity" SelectAttributes: Name: "SelectAttributesActivity" Attributes: - "attribute1" - "attribute2" Next: "FilterActivity" Filter: Name: "FilterActivity" Filter: "attribute1 > 40 AND attribute2 < 20" Next: "MathActivity" Math: Name: "MathActivity" Attribute: "attribute" Math: "attribute - 10" Next: "DeviceRegistryEnrichActivity" DeviceRegistryEnrich: Name: "DeviceRegistryEnrichActivity" Attribute: "attribute" ThingName: "thingName" RoleArn: "arn:aws:iam::<your_Account_Id>:role/Enrich" Next: "DeviceShadowEnrichActivity" DeviceShadowEnrich: Name: "DeviceShadowEnrichActivity" Attribute: "attribute" ThingName: "thingName" RoleArn: "arn:aws:iam::<your_Account_Id>:role/Enrich" Next: "DatastoreActivity" Datastore: Name: "DatastoreActivity" DatastoreName: "Datastore"

另请参阅