CreateTopicRuleDestinationCommand

Creates a topic rule destination. The destination must be confirmed prior to use.

Requires permission to access the CreateTopicRuleDestination  action.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IoTClient, CreateTopicRuleDestinationCommand } from "@aws-sdk/client-iot"; // ES Modules import
// const { IoTClient, CreateTopicRuleDestinationCommand } = require("@aws-sdk/client-iot"); // CommonJS import
const client = new IoTClient(config);
const input = { // CreateTopicRuleDestinationRequest
  destinationConfiguration: { // TopicRuleDestinationConfiguration
    httpUrlConfiguration: { // HttpUrlDestinationConfiguration
      confirmationUrl: "STRING_VALUE", // required
    },
    vpcConfiguration: { // VpcDestinationConfiguration
      subnetIds: [ // SubnetIdList // required
        "STRING_VALUE",
      ],
      securityGroups: [ // SecurityGroupList
        "STRING_VALUE",
      ],
      vpcId: "STRING_VALUE", // required
      roleArn: "STRING_VALUE", // required
    },
  },
};
const command = new CreateTopicRuleDestinationCommand(input);
const response = await client.send(command);
// { // CreateTopicRuleDestinationResponse
//   topicRuleDestination: { // TopicRuleDestination
//     arn: "STRING_VALUE",
//     status: "ENABLED" || "IN_PROGRESS" || "DISABLED" || "ERROR" || "DELETING",
//     createdAt: new Date("TIMESTAMP"),
//     lastUpdatedAt: new Date("TIMESTAMP"),
//     statusReason: "STRING_VALUE",
//     httpUrlProperties: { // HttpUrlDestinationProperties
//       confirmationUrl: "STRING_VALUE",
//     },
//     vpcProperties: { // VpcDestinationProperties
//       subnetIds: [ // SubnetIdList
//         "STRING_VALUE",
//       ],
//       securityGroups: [ // SecurityGroupList
//         "STRING_VALUE",
//       ],
//       vpcId: "STRING_VALUE",
//       roleArn: "STRING_VALUE",
//     },
//   },
// };

CreateTopicRuleDestinationCommand Input

Parameter
Type
Description
destinationConfiguration
Required
TopicRuleDestinationConfiguration | undefined

The topic rule destination configuration.

CreateTopicRuleDestinationCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
topicRuleDestination
TopicRuleDestination | undefined

The topic rule destination.

Throws

Name
Fault
Details
ConflictingResourceUpdateException
client

A conflicting resource update exception. This exception is thrown when two pending updates cause a conflict.

InternalException
server

An unexpected error has occurred.

InvalidRequestException
client

The request is not valid.

ResourceAlreadyExistsException
client

The resource already exists.

ServiceUnavailableException
server

The service is temporarily unavailable.

IoTServiceException
Base exception class for all service exceptions from IoT service.