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

AWS::IoTAnalytics::Dataset

AWS::IoTAnalytics::Dataset 资源存储通过应用“queryAction”(SQL 查询)或“containerAction”(执行容器化应用程序)从数据存储中检索的数据。该数据集可以通过调用“CreateDatasetContent”手动填充,也可以根据您指定的“触发器”自动填充。有关更多信息,请参阅 AWS IoT Analytics 用户指南 中的如何使用 AWS IoT Analytics

语法

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

JSON

{ "Type" : "AWS::IoTAnalytics::Dataset", "Properties" : { "Actions" : [ Action, ... ], "ContentDeliveryRules" : [ DatasetContentDeliveryRule, ... ], "DatasetName" : String, "RetentionPeriod" : RetentionPeriod, "Tags" : [ Tag, ... ], "Triggers" : [ Trigger, ... ], "VersioningConfiguration" : VersioningConfiguration } }

属性

Actions

自动创建数据集内容的 DatasetAction 对象。

必需:是

类型Action 的列表

最高1

Update requires: No interruption

ContentDeliveryRules

在创建数据集内容后,它们将传送到此处指定的目标。

必需:否

类型DatasetContentDeliveryRule 的列表

最高20

Update requires: No interruption

DatasetName

数据集的名称。

必需:否

类型:字符串

最低1

最高128

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

Update requires: Replacement

RetentionPeriod

可选。为数据集保留消息数据的时间长度(以天为单位)。

必需:否

类型RetentionPeriod

Update requires: No interruption

Tags

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

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

必需:否

类型Tag 的列表

最高50

Update requires: No interruption

Triggers

指定何时自动更新数据集的 DatasetTrigger 对象。

必需:否

类型Trigger 的列表

最高5

Update requires: No interruption

VersioningConfiguration

可选。保留的数据集内容版本数。如果未指定或设置为 Null,则只将最新版本以及最新的成功版本(如果它们不同)保留由 retentionPeriod 参数指定的时间段。有关更多信息,请参阅 AWS IoT Analytics 用户指南 中的保留 AWS IoT Analytics 数据集的多个版本

必需:否

类型VersioningConfiguration

Update requires: No interruption

示例

简单 SQL 数据集

以下示例创建一个简单 SQL 数据集。

JSON

{ "Description": "Create a simple SQL Dataset", "Resources": { "Dataset": { "Type": "AWS::IoTAnalytics::Dataset", "Properties": { "DatasetName": "SimpleSQLDataset", "Actions": [ { "ActionName": "SqlAction", "QueryAction": { "SqlQuery": "select * from Datastore" } } ], "Triggers": [ { "Schedule": { "ScheduleExpression": "cron(0 12 * * ? *)" } } ] } } } }

YAML

--- Description: "Create a simple SQL Dataset" Resources: Dataset: Type: "AWS::IoTAnalytics::Dataset" Properties: DatasetName: "SimpleSQLDataset" Actions: - ActionName: "SqlAction" QueryAction: SqlQuery: "select * from Datastore" Triggers: - Schedule: ScheduleExpression: "cron(0 12 * * ? *)"

复杂 SQL 数据集

以下示例创建一个复杂 SQL 数据集。

JSON

{ "Description": "Create a complex SQL Dataset", "Resources": { "Dataset": { "Type": "AWS::IoTAnalytics::Dataset", "Properties": { "DatasetName": "ComplexSQLDataset", "Actions": [ { "ActionName": "SqlAction", "QueryAction": { "SqlQuery": "select * from Datastore", "Filters": [ { "DeltaTime": { "OffsetSeconds": 1, "TimeExpression": "timestamp" } } ] } } ], "Triggers": [ { "Schedule": { "ScheduleExpression": "cron(0 12 * * ? *)" } } ], "RetentionPeriod": { "Unlimited": false, "NumberOfDays": 10 }, "Tags": [ { "Key": "keyname1", "Value": "value1" }, { "Key": "keyname2", "Value": "value2" } ] } } } }

YAML

--- Description: "Create a complex SQL Dataset" Resources: Dataset: Type: "AWS::IoTAnalytics::Dataset" Properties: DatasetName: "ComplexSQLDataset" Actions: - ActionName: "SqlAction" QueryAction: SqlQuery: "select * from Datastore" Filters: - DeltaTime: OffsetSeconds: 1 TimeExpression: "timestamp" Triggers: - Schedule: ScheduleExpression: "cron(0 12 * * ? *)" RetentionPeriod: Unlimited: false NumberOfDays: 10 Tags: - Key: "keyname1" Value: "value1" - Key: "keyname2" Value: "value2"

简单容器数据集

以下示例创建一个简单容器数据集。

JSON

{ "Description": "Create a simple container Dataset", "Resources": { "ContainerDataset": { "Type": "AWS::IoTAnalytics::Dataset", "Properties": { "DatasetName": "SimpleContainerDataset", "Actions": [ { "ActionName": "ContainerAction", "ContainerAction": { "Image": "<your_Account_Id>.dkr.ecr.us-east-1.amazonaws.com/sampleimage", "ExecutionRoleArn": "arn:aws:iam::<your_Account_Id>:role/ExecutionRole", "ResourceConfiguration": { "ComputeType": "ACU_1", "VolumeSizeInGB": 10 }, "Variables": [ { "VariableName": "Variable1", "StringValue": "StringValue" } ] } } ], "Triggers": [ { "Schedule": { "ScheduleExpression": "cron(0 12 * * ? *)" } } ] } } } }

YAML

--- Description: "Create a simple container Dataset" Resources: ContainerDataset: Type: "AWS::IoTAnalytics::Dataset" Properties: DatasetName: "SimpleContainerDataset" Actions: - ActionName: ContainerAction ContainerAction: Image: "<your_Account_Id>.dkr.ecr.us-east-1.amazonaws.com/sampleimage" ExecutionRoleArn: "arn:aws:iam::<your_Account_Id>:role/ExecutionRole" ResourceConfiguration: ComputeType: "ACU_1" VolumeSizeInGB: 10 Variables: - VariableName: "Variable1" StringValue: StringValue Triggers: - Schedule: ScheduleExpression: "cron(0 12 * * ? *)"

复杂容器数据集

以下示例创建一个复杂容器数据集。

JSON

{ "Description": "Create a complex container Dataset", "Resources": { "TriggeringDataset": { "Type": "AWS::IoTAnalytics::Dataset", "Properties": { "DatasetName": "TriggeringDataset", "Actions": [ { "ActionName": "SqlAction", "QueryAction": { "SqlQuery": "select * from Datastore" } } ] } }, "ContainerDataset": { "Type": "AWS::IoTAnalytics::Dataset", "DependsOn": "TriggeringDataset", "Properties": { "DatasetName": "ComplexContainerDataset", "Actions": [ { "ActionName": "ContainerAction", "ContainerAction": { "Image": "<your_Account_Id>.dkr.ecr.us-east-1.amazonaws.com/sampleimage", "ExecutionRoleArn": "arn:aws:iam::<your_Account_Id>:role/ExecutionRole", "ResourceConfiguration": { "ComputeType": "ACU_1", "VolumeSizeInGB": 10 }, "Variables": [ { "VariableName": "Variable1", "StringValue": "StringValue" }, { "VariableName": "Variable2", "DoubleValue": 1 }, { "VariableName": "Variable3", "DatasetContentVersionValue": { "DatasetName": "BasicDataset" } }, { "VariableName": "Variable4", "OutputFileUriValue": { "FileName": "fileName" } } ] } } ], "Triggers": [ { "TriggeringDataset": { "DatasetName": "TriggeringDataset" } } ] } } } }

YAML

--- Description: "Create a complex container Dataset" Resources: TriggeringDataset: Type: "AWS::IoTAnalytics::Dataset" Properties: DatasetName: "TriggeringDataset" Actions: - ActionName: "SqlAction" QueryAction: SqlQuery: "select * from Datastore" ContainerDataset: Type: "AWS::IoTAnalytics::Dataset" DependsOn: TriggeringDataset Properties: DatasetName: "ComplexContainerDataset" Actions: - ActionName: "ContainerAction" ContainerAction: Image: "<your_Account_Id>.dkr.ecr.us-east-1.amazonaws.com/sampleimage" ExecutionRoleArn: "arn:aws:iam::<your_Account_Id>:role/ExecutionRole" ResourceConfiguration: ComputeType: "ACU_1" VolumeSizeInGB: 10 Variables: - VariableName: "Variable1" StringValue: "StringValue" - VariableName: "Variable2" DoubleValue: 1 - VariableName: "Variable3" DatasetContentVersionValue: DatasetName: "BasicDataset" - VariableName: "Variable4" OutputFileUriValue: FileName: "fileName" Triggers: - TriggeringDataset: DatasetName: "TriggeringDataset"

另请参阅