Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex IoT Core
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Sending messages
    • Subscribing a device or registry to receive messages
    • Viewing the connection log
    • Creating a trigger for a topic
    • Managing registries
      • Getting information about registries
      • Creating a registry
      • Updating a registry
      • Deleting a registry
    • Managing devices
      • Managing topic aliases
        • Creating an alias
        • Getting a list of aliases
        • Updating an alias
        • Deleting an alias
      • Getting information about devices
      • Creating a device
      • Updating a device
      • Deleting a device
    • Managing certificates
      • Create a certificate
      • Managing registry certificates
      • Managing device certificates
    • Managing passwords
      • Managing registry passwords
      • Managing device passwords
  • Concepts
    • Authorization
    • Relationship between service resources
    • MQTT broker connection parameters
    • Sending messages to an MQTT broker via gRPC
    • Topic
    • Backups
    • Quotas and limits
  • Use cases
    • All use cases
    • Working with Mosquitto
      • Sending messages
      • Subscribing a device or registry to receive messages
    • Working with Yandex IoT Core from an Android device in Java
    • Working with Yandex IoT Core in C#
    • Working with Yandex IoT Core in Java
    • Writing data from a device to Managed Service for PostgreSQL
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • DeviceDataService
      • DeviceService
      • RegistryDataService
      • RegistryService
      • OperationService
    • REST
      • Overview
      • Device
        • Overview
        • addCertificate
        • addPassword
        • create
        • delete
        • deleteCertificate
        • deletePassword
        • get
        • list
        • listCertificates
        • listOperations
        • listPasswords
        • update
      • DeviceData
        • Overview
        • publish
      • Registry
        • Overview
        • addCertificate
        • addPassword
        • create
        • delete
        • deleteCertificate
        • deletePassword
        • get
        • list
        • listCertificates
        • listDeviceTopicAliases
        • listOperations
        • listPasswords
        • update
      • RegistryData
        • Overview
        • publish
  • Questions and answers
  1. Step-by-step instructions
  2. Managing devices
  3. Creating a device

Creating a device

    Management console
    CLI
    Terraform

    To create a device:

    1. In the management console, select the folder where you want to create a device.
    2. Select Yandex IoT Core.
    3. Select the desired registry from the list.
    4. In the left part of the window, select Devices.
    5. Click Add device.
    6. Specify basic parameters for the device:
      • Enter a device Name. For example, my-device.
      • (optional) Add a Description with additional information about the device.
      • Set a Password that you'll use to access the device.
        To do this, you can use the password generator.
        Don't forget to save your password because you'll need it later.
    7. (optional) Add aliases:
      1. Click Add alias.
      2. Fill in the fields: enter an alias (for example, events) and the topic type after $devices/<deviceID> (for example, events).
        You can use the events alias instead of the $devices/<deviceID>/events topic.
    8. (optional) Add certificates:
      • To add a file:
        1. Choose the File method.
        2. Click Select file.
        3. Specify the certificate file on your computer and click Open.
        4. Click Add.
      • To add text:
        1. Choose the Text method.
        2. Insert the certificate body in the Contents field.
        3. Click Add.
    9. Click Add.

    If you don't have the Yandex.Cloud command line interface yet, install and initialize it.

    1. View the list of registries where you can create a device or create a new registry.

    2. Create a device:

      $ yc iot device create --registry-name my-registry --name my-device
      
      id: b9135goeh1uc1s2i07nm
      registry_id: b91ki3851hab9m0l68je
      created_at: "2019-05-28T16:08:30.938Z"
      name: my-device
      
      • Length — from 3 to 63 characters.
      • The name may contain lowercase Latin letters, numbers, and hyphens.
      • The first character must be a letter. The last character can't be a hyphen.
    3. Make sure the device was created:

      $ yc iot device list --registry-name  my-registry
      +----------------------+-----------+
      |          ID          |   NAME    |
      +----------------------+-----------+
      | b9135goeh1uc1s2i07nm | my-device |
      +----------------------+-----------+
      

    With Terraform, you can quickly create a cloud infrastructure in Yandex.Cloud. The infrastructure components are identified through configuration files that specify the required cloud resources and their parameters.

    If you don't have Terraform yet, install it and configure the Yandex.Cloud provider.

    Note

    To add certificates to the device, create them in advance.

    To create a device:

    1. View the list of registries where you can create a device or create a new registry.

    2. In the configuration file, describe the parameters of the resource to create:

      • yandex_iot_core_device: Device parameters:
        • registry_id: ID of the registry to create a device in.
        • name: Device name.
        • description: Device description.
        • aliases: Topic aliases. For more information, see Creating an alias
        • passwords: List of passwords for authorization using a username and password.
        • certificates: List of certificates for authorization using certificates.

      Sample resource structure in the configuration file:

      resource "yandex_iot_core_device" "my_device" {
        registry_id = "<registry ID>"
        name        = "test-device"
        description = "test device for terraform provider documentation"
      
        aliases = {
          "some-alias1/subtopic" = "$devices/{id}/events/somesubtopic",
          "some-alias2/subtopic" = "$devices/{id}/events/aaa/bbb",
        }
      
        passwords = [
          "<password>",
        ]
      
        certificates = [
          file("<path to the certificate file>")
        ]
      }
      

      For more information about the resources you can create using Terraform, see the provider documentation.

    3. Make sure that the configuration files are correct.

      1. In the command line, go to the directory where you created the configuration file.

      2. Run the check using the command:

        $ terraform plan
        

      If the configuration is described correctly, the terminal displays a list of created resources and their parameters. If there are errors in the configuration, Terraform points them out.

    4. Deploy the cloud resources.

      1. If the configuration doesn't contain any errors, run the command:

        $ terraform apply
        
      2. Confirm that you want to create the resources.

      Afterwards, all the necessary resources are created in the specified folder. You can check resource availability and their settings in management console.

    Language / Region
    Careers
    Privacy policy
    Terms of use
    Brandbook
    © 2021 Yandex.Cloud LLC