Skip to content
GitHubXDiscordRSS

TopicRuleDestination

Learn how to create, update, and manage AWS IoT TopicRuleDestinations using Alchemy Cloud Control.

The TopicRuleDestination resource allows you to manage AWS IoT TopicRuleDestinations which are used to define the destinations for IoT messages based on topic rules.

Create a basic TopicRuleDestination with a specified status and HTTP URL properties.

import AWS from "alchemy/aws/control";
const topicRuleDestination = await AWS.IoT.TopicRuleDestination("myTopicRuleDestination", {
Status: "ENABLED",
HttpUrlProperties: {
Authorization: "Bearer myToken",
Url: "https://api.example.com/iot/destination"
}
});

Configure a TopicRuleDestination with VPC properties for secure access within a specified VPC.

const vpcDestination = await AWS.IoT.TopicRuleDestination("myVpcTopicRuleDestination", {
Status: "ENABLED",
VpcProperties: {
VpcId: "vpc-12345678",
SubnetIds: ["subnet-12345678", "subnet-87654321"],
SecurityGroupIds: ["sg-12345678"],
Port: 443
}
});

If you want to adopt an existing TopicRuleDestination without failing, you can set the adopt property to true.

const adoptExistingDestination = await AWS.IoT.TopicRuleDestination("existingDestination", {
Status: "ENABLED",
adopt: true
});

Create a TopicRuleDestination that has both HTTP URL properties and VPC properties.

const combinedDestination = await AWS.IoT.TopicRuleDestination("combinedDestination", {
Status: "ENABLED",
HttpUrlProperties: {
Authorization: "Bearer mySecureToken",
Url: "https://api.example.com/iot/combined"
},
VpcProperties: {
VpcId: "vpc-abcdef01",
SubnetIds: ["subnet-abcdef01", "subnet-fedcba10"],
SecurityGroupIds: ["sg-abcdef01"],
Port: 443
}
});