AWS::IoTAnalytics::Dataset - AWS CloudFormation

AWS::IoTAnalytics::Dataset

The AWS::IoTAnalytics::Dataset resource stores data retrieved from a data store by applying a queryAction (an SQL query) or a containerAction (executing a containerized application). The data set can be populated manually by calling CreateDatasetContent or automatically according to a trigger you specify. 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, ... ], "ContentDeliveryRules" : [ DatasetContentDeliveryRule, ... ], "DatasetName" : String, "LateDataRules" : [ LateDataRule, ... ], "RetentionPeriod" : RetentionPeriod, "Tags" : [ Tag, ... ], "Triggers" : [ Trigger, ... ], "VersioningConfiguration" : VersioningConfiguration } }

Properties

Actions

The DatasetAction objects that automatically create the data set contents.

Required: Yes

Type: List of Action

Maximum: 1

Update requires: No interruption

ContentDeliveryRules

When dataset contents are created they are delivered to destinations specified here.

Required: No

Type: List of DatasetContentDeliveryRule

Maximum: 20

Update requires: No interruption

DatasetName

The name of the data set.

Required: No

Type: String

Minimum: 1

Maximum: 128

Pattern: ^[a-zA-Z0-9_]+$

Update requires: Replacement

LateDataRules

A list of data rules that send notifications to Amazon CloudWatch, when data arrives late. To specify lateDataRules, the dataset must use a DeltaTimer filter.

Required: No

Type: List of LateDataRule

Maximum: 1

Update requires: No interruption

RetentionPeriod

Optional. 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.

For more information, see Tag.

Required: No

Type: List of Tag

Maximum: 50

Update requires: No interruption

Triggers

The DatasetTrigger objects that specify when the data set is automatically updated.

Required: No

Type: List of Trigger

Maximum: 5

Update requires: No interruption

VersioningConfiguration

Optional. How many versions of dataset contents are kept. If not specified or set to null, only the latest version plus the latest succeeded version (if they are different) are kept for the time period specified by the retentionPeriod parameter. For more information, see Keeping Multiple Versions of AWS IoT Analytics Data Sets in the AWS IoT Analytics User Guide.

Required: No

Type: VersioningConfiguration

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