Destination
The Destination resource allows you to manage AWS IoTWireless Destinations for routing messages from your IoT devices to AWS services.
Minimal Example
Section titled “Minimal Example”Create a basic IoTWireless Destination with required properties and one optional property.
import AWS from "alchemy/aws/control";
const simpleDestination = await AWS.IoTWireless.Destination("simpleDestination", { Name: "SimpleDestination", Expression: "SELECT * FROM 'iot/topic'", ExpressionType: "RuleQueryString", Description: "A simple destination for routing IoT messages", RoleArn: "arn:aws:iam::123456789012:role/MyIoTRole"});
Advanced Configuration
Section titled “Advanced Configuration”Configure a more complex IoTWireless Destination with multiple tags and necessary IAM role.
const advancedDestination = await AWS.IoTWireless.Destination("advancedDestination", { Name: "AdvancedDestination", Expression: "SELECT * FROM 'iot/topic'", ExpressionType: "RuleQueryString", RoleArn: "arn:aws:iam::123456789012:role/MyIoTRole", Tags: [ { Key: "Environment", Value: "Production" }, { Key: "Project", Value: "IoTMonitoring" } ]});
Using Existing Resources
Section titled “Using Existing Resources”If you want to adopt an existing resource instead of failing when it already exists, set the adopt
property to true
.
const adoptDestination = await AWS.IoTWireless.Destination("adoptDestination", { Name: "ExistingDestination", Expression: "SELECT * FROM 'iot/topic'", ExpressionType: "RuleQueryString", adopt: true});