AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::IoTAnalytics::Dataset

The AWS::IoTAnalytics::Dataset resource retrieves data from a data store. For more information, see How to Use AWS IoT Analytics in the AWS IoT Analytics User Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

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

YAML

Type: "AWS::IoTAnalytics::Dataset" Properties: Actions: - Action DatasetName: String RetentionPeriod: RetentionPeriod Tags: - Tag Triggers: - Trigger

Properties

Actions

A list of actions that create the data set contents.

Required: Yes

Type: List of Action property types

Update requires: No interruption

DatasetName

The name of the data set.

Required: No

Type: String

Update requires: Replacement

RetentionPeriod

How long, in days, message data is kept for the data set.

Required: No

Type: RetentionPeriod

Update requires: No interruption

Tags

Metadata which can be used to manage the data set.

Required: No

Type: List of Resource Tag property types

Update requires: No interruption

Triggers

A list of triggers. A trigger causes data set contents to be populated at a specified time interval or when another data set's contents are created. The list of triggers can be empty or contain up to five objects.

Required: No

Type: List of Trigger property types

Update requires: No interruption

Examples

Simple SQL Dataset

The following example creates a simple SQL dataset.

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 * * ? *)"

Complex SQL Dataset

The following example creates a complex SQL dataset.

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"

Simple Container Dataset

The following example creates a simple container dataset.

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 * * ? *)"

Complex Container Dataset

The following example creates a complex container dataset.

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"

See Also