@aws-sdk/client-iot
TypeScript icon, indicating that this package has built-in type declarations

3.565.0 • Public • Published

@aws-sdk/client-iot

Description

AWS SDK for JavaScript IoT Client for Node.js, Browser and React Native.

IoT

IoT provides secure, bi-directional communication between Internet-connected devices (such as sensors, actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. You can discover your custom IoT-Data endpoint to communicate with, configure rules for data processing and integration with other services, organize resources associated with each device (Registry), configure logging, and create and manage policies and credentials to authenticate devices.

The service endpoints that expose this API are listed in Amazon Web Services IoT Core Endpoints and Quotas. You must use the endpoint for the region that has the resources you want to access.

The service name used by Amazon Web Services Signature Version 4 to sign the request is: execute-api.

For more information about how IoT works, see the Developer Guide.

For information about how to use the credentials provider for IoT, see Authorizing Direct Calls to Amazon Web Services Services.

Installing

To install the this package, simply type add or install @aws-sdk/client-iot using your favorite package manager:

  • npm install @aws-sdk/client-iot
  • yarn add @aws-sdk/client-iot
  • pnpm add @aws-sdk/client-iot

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the IoTClient and the commands you need, for example ListIndicesCommand:

// ES5 example
const { IoTClient, ListIndicesCommand } = require("@aws-sdk/client-iot");
// ES6+ example
import { IoTClient, ListIndicesCommand } from "@aws-sdk/client-iot";

Usage

To send a request, you:

  • Initiate client with configuration (e.g. credentials, region).
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
  • If you are using a custom http handler, you may call destroy() to close open connections.
// a client can be shared by different commands.
const client = new IoTClient({ region: "REGION" });

const params = {
  /** input parameters */
};
const command = new ListIndicesCommand(params);

Async/await

We recommend using await operator to wait for the promise returned by send operation as follows:

// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.

Promises

You can also use Promise chaining to execute send operation.

client.send(command).then(
  (data) => {
    // process data.
  },
  (error) => {
    // error handling.
  }
);

Promises can also be called using .catch() and .finally() as follows:

client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Callbacks

We do not recommend using callbacks because of callback hell, but they are supported by the send operation.

// callbacks.
client.send(command, (err, data) => {
  // process err and data.
});

v2 compatible style

The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript

import * as AWS from "@aws-sdk/client-iot";
const client = new AWS.IoT({ region: "REGION" });

// async/await.
try {
  const data = await client.listIndices(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listIndices(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks.
client.listIndices(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

Getting Help

Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-iot package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

AcceptCertificateTransfer

Command API Reference / Input / Output

AddThingToBillingGroup

Command API Reference / Input / Output

AddThingToThingGroup

Command API Reference / Input / Output

AssociateTargetsWithJob

Command API Reference / Input / Output

AttachPolicy

Command API Reference / Input / Output

AttachPrincipalPolicy

Command API Reference / Input / Output

AttachSecurityProfile

Command API Reference / Input / Output

AttachThingPrincipal

Command API Reference / Input / Output

CancelAuditMitigationActionsTask

Command API Reference / Input / Output

CancelAuditTask

Command API Reference / Input / Output

CancelCertificateTransfer

Command API Reference / Input / Output

CancelDetectMitigationActionsTask

Command API Reference / Input / Output

CancelJob

Command API Reference / Input / Output

CancelJobExecution

Command API Reference / Input / Output

ClearDefaultAuthorizer

Command API Reference / Input / Output

ConfirmTopicRuleDestination

Command API Reference / Input / Output

CreateAuditSuppression

Command API Reference / Input / Output

CreateAuthorizer

Command API Reference / Input / Output

CreateBillingGroup

Command API Reference / Input / Output

CreateCertificateFromCsr

Command API Reference / Input / Output

CreateCertificateProvider

Command API Reference / Input / Output

CreateCustomMetric

Command API Reference / Input / Output

CreateDimension

Command API Reference / Input / Output

CreateDomainConfiguration

Command API Reference / Input / Output

CreateDynamicThingGroup

Command API Reference / Input / Output

CreateFleetMetric

Command API Reference / Input / Output

CreateJob

Command API Reference / Input / Output

CreateJobTemplate

Command API Reference / Input / Output

CreateKeysAndCertificate

Command API Reference / Input / Output

CreateMitigationAction

Command API Reference / Input / Output

CreateOTAUpdate

Command API Reference / Input / Output

CreatePackage

Command API Reference / Input / Output

CreatePackageVersion

Command API Reference / Input / Output

CreatePolicy

Command API Reference / Input / Output

CreatePolicyVersion

Command API Reference / Input / Output

CreateProvisioningClaim

Command API Reference / Input / Output

CreateProvisioningTemplate

Command API Reference / Input / Output

CreateProvisioningTemplateVersion

Command API Reference / Input / Output

CreateRoleAlias

Command API Reference / Input / Output

CreateScheduledAudit

Command API Reference / Input / Output

CreateSecurityProfile

Command API Reference / Input / Output

CreateStream

Command API Reference / Input / Output

CreateThing

Command API Reference / Input / Output

CreateThingGroup

Command API Reference / Input / Output

CreateThingType

Command API Reference / Input / Output

CreateTopicRule

Command API Reference / Input / Output

CreateTopicRuleDestination

Command API Reference / Input / Output

DeleteAccountAuditConfiguration

Command API Reference / Input / Output

DeleteAuditSuppression

Command API Reference / Input / Output

DeleteAuthorizer

Command API Reference / Input / Output

DeleteBillingGroup

Command API Reference / Input / Output

DeleteCACertificate

Command API Reference / Input / Output

DeleteCertificate

Command API Reference / Input / Output

DeleteCertificateProvider

Command API Reference / Input / Output

DeleteCustomMetric

Command API Reference / Input / Output

DeleteDimension

Command API Reference / Input / Output

DeleteDomainConfiguration

Command API Reference / Input / Output

DeleteDynamicThingGroup

Command API Reference / Input / Output

DeleteFleetMetric

Command API Reference / Input / Output

DeleteJob

Command API Reference / Input / Output

DeleteJobExecution

Command API Reference / Input / Output

DeleteJobTemplate

Command API Reference / Input / Output

DeleteMitigationAction

Command API Reference / Input / Output

DeleteOTAUpdate

Command API Reference / Input / Output

DeletePackage

Command API Reference / Input / Output

DeletePackageVersion

Command API Reference / Input / Output

DeletePolicy

Command API Reference / Input / Output

DeletePolicyVersion

Command API Reference / Input / Output

DeleteProvisioningTemplate

Command API Reference / Input / Output

DeleteProvisioningTemplateVersion

Command API Reference / Input / Output

DeleteRegistrationCode

Command API Reference / Input / Output

DeleteRoleAlias

Command API Reference / Input / Output

DeleteScheduledAudit

Command API Reference / Input / Output

DeleteSecurityProfile

Command API Reference / Input / Output

DeleteStream

Command API Reference / Input / Output

DeleteThing

Command API Reference / Input / Output

DeleteThingGroup

Command API Reference / Input / Output

DeleteThingType

Command API Reference / Input / Output

DeleteTopicRule

Command API Reference / Input / Output

DeleteTopicRuleDestination

Command API Reference / Input / Output

DeleteV2LoggingLevel

Command API Reference / Input / Output

DeprecateThingType

Command API Reference / Input / Output

DescribeAccountAuditConfiguration

Command API Reference / Input / Output

DescribeAuditFinding

Command API Reference / Input / Output

DescribeAuditMitigationActionsTask

Command API Reference / Input / Output

DescribeAuditSuppression

Command API Reference / Input / Output

DescribeAuditTask

Command API Reference / Input / Output

DescribeAuthorizer

Command API Reference / Input / Output

DescribeBillingGroup

Command API Reference / Input / Output

DescribeCACertificate

Command API Reference / Input / Output

DescribeCertificate

Command API Reference / Input / Output

DescribeCertificateProvider

Command API Reference / Input / Output

DescribeCustomMetric

Command API Reference / Input / Output

DescribeDefaultAuthorizer

Command API Reference / Input / Output

DescribeDetectMitigationActionsTask

Command API Reference / Input / Output

DescribeDimension

Command API Reference / Input / Output

DescribeDomainConfiguration

Command API Reference / Input / Output

DescribeEndpoint

Command API Reference / Input / Output

DescribeEventConfigurations

Command API Reference / Input / Output

DescribeFleetMetric

Command API Reference / Input / Output

DescribeIndex

Command API Reference / Input / Output

DescribeJob

Command API Reference / Input / Output

DescribeJobExecution

Command API Reference / Input / Output

DescribeJobTemplate

Command API Reference / Input / Output

DescribeManagedJobTemplate

Command API Reference / Input / Output

DescribeMitigationAction

Command API Reference / Input / Output

DescribeProvisioningTemplate

Command API Reference / Input / Output

DescribeProvisioningTemplateVersion

Command API Reference / Input / Output

DescribeRoleAlias

Command API Reference / Input / Output

DescribeScheduledAudit

Command API Reference / Input / Output

DescribeSecurityProfile

Command API Reference / Input / Output

DescribeStream

Command API Reference / Input / Output

DescribeThing

Command API Reference / Input / Output

DescribeThingGroup

Command API Reference / Input / Output

DescribeThingRegistrationTask

Command API Reference / Input / Output

DescribeThingType

Command API Reference / Input / Output

DetachPolicy

Command API Reference / Input / Output

DetachPrincipalPolicy

Command API Reference / Input / Output

DetachSecurityProfile

Command API Reference / Input / Output

DetachThingPrincipal

Command API Reference / Input / Output

DisableTopicRule

Command API Reference / Input / Output

EnableTopicRule

Command API Reference / Input / Output

GetBehaviorModelTrainingSummaries

Command API Reference / Input / Output

GetBucketsAggregation

Command API Reference / Input / Output

GetCardinality

Command API Reference / Input / Output

GetEffectivePolicies

Command API Reference / Input / Output

GetIndexingConfiguration

Command API Reference / Input / Output

GetJobDocument

Command API Reference / Input / Output

GetLoggingOptions

Command API Reference / Input / Output

GetOTAUpdate

Command API Reference / Input / Output

GetPackage

Command API Reference / Input / Output

GetPackageConfiguration

Command API Reference / Input / Output

GetPackageVersion

Command API Reference / Input / Output

GetPercentiles

Command API Reference / Input / Output

GetPolicy

Command API Reference / Input / Output

GetPolicyVersion

Command API Reference / Input / Output

GetRegistrationCode

Command API Reference / Input / Output

GetStatistics

Command API Reference / Input / Output

GetTopicRule

Command API Reference / Input / Output

GetTopicRuleDestination

Command API Reference / Input / Output

GetV2LoggingOptions

Command API Reference / Input / Output

ListActiveViolations

Command API Reference / Input / Output

ListAttachedPolicies

Command API Reference / Input / Output

ListAuditFindings

Command API Reference / Input / Output

ListAuditMitigationActionsExecutions

Command API Reference / Input / Output

ListAuditMitigationActionsTasks

Command API Reference / Input / Output

ListAuditSuppressions

Command API Reference / Input / Output

ListAuditTasks

Command API Reference / Input / Output

ListAuthorizers

Command API Reference / Input / Output

ListBillingGroups

Command API Reference / Input / Output

ListCACertificates

Command API Reference / Input / Output

ListCertificateProviders

Command API Reference / Input / Output

ListCertificates

Command API Reference / Input / Output

ListCertificatesByCA

Command API Reference / Input / Output

ListCustomMetrics

Command API Reference / Input / Output

ListDetectMitigationActionsExecutions

Command API Reference / Input / Output

ListDetectMitigationActionsTasks

Command API Reference / Input / Output

ListDimensions

Command API Reference / Input / Output

ListDomainConfigurations

Command API Reference / Input / Output

ListFleetMetrics

Command API Reference / Input / Output

ListIndices

Command API Reference / Input / Output

ListJobExecutionsForJob

Command API Reference / Input / Output

ListJobExecutionsForThing

Command API Reference / Input / Output

ListJobs

Command API Reference / Input / Output

ListJobTemplates

Command API Reference / Input / Output

ListManagedJobTemplates

Command API Reference / Input / Output

ListMetricValues

Command API Reference / Input / Output

ListMitigationActions

Command API Reference / Input / Output

ListOTAUpdates

Command API Reference / Input / Output

ListOutgoingCertificates

Command API Reference / Input / Output

ListPackages

Command API Reference / Input / Output

ListPackageVersions

Command API Reference / Input / Output

ListPolicies

Command API Reference / Input / Output

ListPolicyPrincipals

Command API Reference / Input / Output

ListPolicyVersions

Command API Reference / Input / Output

ListPrincipalPolicies

Command API Reference / Input / Output

ListPrincipalThings

Command API Reference / Input / Output

ListProvisioningTemplates

Command API Reference / Input / Output

ListProvisioningTemplateVersions

Command API Reference / Input / Output

ListRelatedResourcesForAuditFinding

Command API Reference / Input / Output

ListRoleAliases

Command API Reference / Input / Output

ListScheduledAudits

Command API Reference / Input / Output

ListSecurityProfiles

Command API Reference / Input / Output

ListSecurityProfilesForTarget

Command API Reference / Input / Output

ListStreams

Command API Reference / Input / Output

ListTagsForResource

Command API Reference / Input / Output

ListTargetsForPolicy

Command API Reference / Input / Output

ListTargetsForSecurityProfile

Command API Reference / Input / Output

ListThingGroups

Command API Reference / Input / Output

ListThingGroupsForThing

Command API Reference / Input / Output

ListThingPrincipals

Command API Reference / Input / Output

ListThingRegistrationTaskReports

Command API Reference / Input / Output

ListThingRegistrationTasks

Command API Reference / Input / Output

ListThings

Command API Reference / Input / Output

ListThingsInBillingGroup

Command API Reference / Input / Output

ListThingsInThingGroup

Command API Reference / Input / Output

ListThingTypes

Command API Reference / Input / Output

ListTopicRuleDestinations

Command API Reference / Input / Output

ListTopicRules

Command API Reference / Input / Output

ListV2LoggingLevels

Command API Reference / Input / Output

ListViolationEvents

Command API Reference / Input / Output

PutVerificationStateOnViolation

Command API Reference / Input / Output

RegisterCACertificate

Command API Reference / Input / Output

RegisterCertificate

Command API Reference / Input / Output

RegisterCertificateWithoutCA

Command API Reference / Input / Output

RegisterThing

Command API Reference / Input / Output

RejectCertificateTransfer

Command API Reference / Input / Output

RemoveThingFromBillingGroup

Command API Reference / Input / Output

RemoveThingFromThingGroup

Command API Reference / Input / Output

ReplaceTopicRule

Command API Reference / Input / Output

SearchIndex

Command API Reference / Input / Output

SetDefaultAuthorizer

Command API Reference / Input / Output

SetDefaultPolicyVersion

Command API Reference / Input / Output

SetLoggingOptions

Command API Reference / Input / Output

SetV2LoggingLevel

Command API Reference / Input / Output

SetV2LoggingOptions

Command API Reference / Input / Output

StartAuditMitigationActionsTask

Command API Reference / Input / Output

StartDetectMitigationActionsTask

Command API Reference / Input / Output

StartOnDemandAuditTask

Command API Reference / Input / Output

StartThingRegistrationTask

Command API Reference / Input / Output

StopThingRegistrationTask

Command API Reference / Input / Output

TagResource

Command API Reference / Input / Output

TestAuthorization

Command API Reference / Input / Output

TestInvokeAuthorizer

Command API Reference / Input / Output

TransferCertificate

Command API Reference / Input / Output

UntagResource

Command API Reference / Input / Output

UpdateAccountAuditConfiguration

Command API Reference / Input / Output

UpdateAuditSuppression

Command API Reference / Input / Output

UpdateAuthorizer

Command API Reference / Input / Output

UpdateBillingGroup

Command API Reference / Input / Output

UpdateCACertificate

Command API Reference / Input / Output

UpdateCertificate

Command API Reference / Input / Output

UpdateCertificateProvider

Command API Reference / Input / Output

UpdateCustomMetric

Command API Reference / Input / Output

UpdateDimension

Command API Reference / Input / Output

UpdateDomainConfiguration

Command API Reference / Input / Output

UpdateDynamicThingGroup

Command API Reference / Input / Output

UpdateEventConfigurations

Command API Reference / Input / Output

UpdateFleetMetric

Command API Reference / Input / Output

UpdateIndexingConfiguration

Command API Reference / Input / Output

UpdateJob

Command API Reference / Input / Output

UpdateMitigationAction

Command API Reference / Input / Output

UpdatePackage

Command API Reference / Input / Output

UpdatePackageConfiguration

Command API Reference / Input / Output

UpdatePackageVersion

Command API Reference / Input / Output

UpdateProvisioningTemplate

Command API Reference / Input / Output

UpdateRoleAlias

Command API Reference / Input / Output

UpdateScheduledAudit

Command API Reference / Input / Output

UpdateSecurityProfile

Command API Reference / Input / Output

UpdateStream

Command API Reference / Input / Output

UpdateThing

Command API Reference / Input / Output

UpdateThingGroup

Command API Reference / Input / Output

UpdateThingGroupsForThing

Command API Reference / Input / Output

UpdateTopicRuleDestination

Command API Reference / Input / Output

ValidateSecurityProfileBehaviors

Command API Reference / Input / Output

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @aws-sdk/client-iot

Weekly Downloads

206,465

Version

3.565.0

License

Apache-2.0

Unpacked Size

4.37 MB

Total Files

1022

Last publish

Collaborators

  • mattsb42-aws
  • kuhe
  • amzn-oss
  • aws-sdk-bot
  • trivikr-aws