Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uhuru/awsiot-thing-creator

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uhuru/awsiot-thing-creator

- `npm install @uhuru/awsiot-thing-creator` - `yarn add @uhuru/awsiot-thing-creator`

  • 1.0.1-beta.26
  • npm
  • Socket score

Version published
Weekly downloads
14
increased by7.69%
Maintainers
4
Weekly downloads
 
Created
Source

@uhuru/awsiot-thing-creator

Installing

  • npm install @uhuru/awsiot-thing-creator
  • yarn add @uhuru/awsiot-thing-creator

Environment Variables

Supported environment variables:

ENV                              DESCRIPTION
AWS_ACCESS_KEY_ID                AWS access key ID
AWS_SECRET_ACCESS_KEY            AWS secret access key
AWS_IOT_REGION                   AWS IoT region
AWS_IOT_THING_NAME               The name of the AWS IoT thing to be created

npm start

This library can be called by npm-start command.

$ npm start -- --aws-access-key-id=hoge --aws-secret-access-key=foo --aws-iot-region=bar --aws-iot-thing-name=buzz --thing-attribute-payload={\"attributes\":{\"string1\":\"string2\"}} --thing-type-name=Device

Note that you need to build this package before running npm start.

$ npm run build

The arguments

ArgumentRequiredDescriptionExample
--aws-access-key-idYesAWS access key IDAKIAJWWCHDEPQJD456PQ
--aws-secret-access-keyYesAWS secret access key6qtl9JJ90ue5CMeHSJKm1I4iRRwKOQKLCpzt9Y94
--aws-iot-regionYesAWS IoT regionus-west-2
--aws-iot-thing-nameYesThe name of the AWS IoT thing to be createdenebular-agent-test
--thing-attribute-payloadNoThe attribute payload{\"attributes\":{\"string1\":\"string2\"}
--thing-type-nameNoThe name of the thing typeDevice

For more details about above arguments, please refer to AWS document

IoT Client - AWS SDK for JavaScript v3

ECMAScript Modules

This library can also be used as ECMAScript Module.

import { AWSIoTThingCreator } from '@uhuru/awsiot-thing-creator';

const attributePayload = {
  atrributes: {
    key: "value"
  }
}

const config = {
  awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID,
  awsSecretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  awsIotRegion: process.env.AWS_IOT_REGION,
  thingName: "enebular-agent-test",
  thingTypeName: "Device",
  thingAttributePayload: attributePayload
}

// Check required variables
if (
  !config.awsAccessKeyId ||
  !config.awsIotRegion ||
  !config.awsSecretAccessKey ||
  !config.thingName
) {
  throw new Error(`
  A configuration is required.
  Verify that these required environment variables are set:
      - AWS_ACCESS_KEY_ID
      - AWS_IOT_REGION
      - AWS_SECRET_ACCESS_KEY
      - awsIotThingName
  `)
}

const creator = new AWSIoTThingCreator(config)
const result = await creator.createThing().catch((error) => {
  console.error(error.message)
  throw new Error('Failed to create thing.')
})

return {
  config: result.config,
  rootPem: result.rootPem,
  clientPem: result.clientPem,
  privateKey: result.privateKey
}

FAQs

Package last updated on 15 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc