Skip to content
GitHubXDiscord

DeviceDefinitionVersion

The DeviceDefinitionVersion resource allows you to create and manage versions of device definitions in AWS Greengrass, which is essential for deploying applications on IoT devices. For more information, refer to the AWS Greengrass DeviceDefinitionVersions documentation.

Create a basic DeviceDefinitionVersion with required properties and a common optional property.

import AWS from "alchemy/aws/control";
const deviceDefinitionVersion = await AWS.Greengrass.DeviceDefinitionVersion("myDeviceDefinitionVersion", {
DeviceDefinitionId: "myDeviceDefinitionId",
Devices: [
{
Id: "myDevice1",
Type: "thing",
ThingArn: "arn:aws:iot:us-west-2:123456789012:thing/MyDevice1"
}
],
adopt: true // Optional: Adopt existing resource if it already exists
});

Configure a DeviceDefinitionVersion with multiple devices and additional settings.

const advancedDeviceDefinitionVersion = await AWS.Greengrass.DeviceDefinitionVersion("myAdvancedDeviceDefinitionVersion", {
DeviceDefinitionId: "myAdvancedDeviceDefinitionId",
Devices: [
{
Id: "myDevice2",
Type: "thing",
ThingArn: "arn:aws:iot:us-west-2:123456789012:thing/MyDevice2"
},
{
Id: "myDevice3",
Type: "thing",
ThingArn: "arn:aws:iot:us-west-2:123456789012:thing/MyDevice3"
}
]
});

Update an existing DeviceDefinitionVersion to include new devices.

const updatedDeviceDefinitionVersion = await AWS.Greengrass.DeviceDefinitionVersion("myUpdatedDeviceDefinitionVersion", {
DeviceDefinitionId: "myDeviceDefinitionId",
Devices: [
{
Id: "myDevice4",
Type: "thing",
ThingArn: "arn:aws:iot:us-west-2:123456789012:thing/MyDevice4"
},
{
Id: "myDevice5",
Type: "thing",
ThingArn: "arn:aws:iot:us-west-2:123456789012:thing/MyDevice5"
}
],
adopt: false // Optional: Do not adopt existing resource
});