Skip to content
GitHubXDiscordRSS

Datastore

Learn how to create, update, and manage AWS IoTAnalytics Datastores using Alchemy Cloud Control.

The Datastore resource lets you manage AWS IoTAnalytics Datastores for storing and querying data from IoT devices.

Create a basic IoTAnalytics Datastore with required properties and a retention period.

import AWS from "alchemy/aws/control";
const basicDatastore = await AWS.IoTAnalytics.Datastore("basicDatastore", {
DatastoreName: "BasicDatastore",
DatastoreStorage: {
S3: {
Bucket: "my-iot-analytics-bucket",
KeyPrefix: "datastore/"
}
},
RetentionPeriod: {
NumberOfDays: 30,
Unlimited: false
}
});

Configure an IoTAnalytics Datastore with file format settings and partitioning.

const advancedDatastore = await AWS.IoTAnalytics.Datastore("advancedDatastore", {
DatastoreName: "AdvancedDatastore",
DatastoreStorage: {
S3: {
Bucket: "my-iot-analytics-advanced-bucket",
KeyPrefix: "advanced-datastore/"
}
},
FileFormatConfiguration: {
Json: {
Enable: true
}
},
DatastorePartitions: {
Partitions: [
{
Partition: {
Attribute: "deviceId",
Type: "STRING"
}
}
]
},
RetentionPeriod: {
NumberOfDays: 60,
Unlimited: false
}
});

Create a Datastore with tags for better resource management.

const taggedDatastore = await AWS.IoTAnalytics.Datastore("taggedDatastore", {
DatastoreName: "TaggedDatastore",
DatastoreStorage: {
S3: {
Bucket: "my-iot-analytics-tagged-bucket",
KeyPrefix: "tagged-datastore/"
}
},
Tags: [
{
Key: "Environment",
Value: "Production"
},
{
Key: "Project",
Value: "IoTAnalytics"
}
]
});

Create a Datastore while adopting an existing resource if it already exists.

const adoptExistingDatastore = await AWS.IoTAnalytics.Datastore("adoptExistingDatastore", {
DatastoreName: "ExistingDatastore",
DatastoreStorage: {
S3: {
Bucket: "my-existing-bucket",
KeyPrefix: "existing-datastore/"
}
},
adopt: true
});