[Yandex Cloud documentation](../index.md) > [Yandex IoT Core](index.md) > Getting started > Device registry

# Getting started with Yandex IoT Core device registries

{% note warning %}

Yandex IoT Core is no longer available to new users. 

Current users can create resources until November 1, 2026. Afterwards, the service will go read-only and cease to operate on December 1, 2026. For more information on the timing and procedure, see [Service shutdown](sunset.md).

{% endnote %}

To start using the Yandex IoT Core service, create the following:

1. [X.509 certificates](#create-ca)
1. [Registry](#create-registry)
1. [Device](#create-device)

Then, [set up message exchange](#exchange) between the device and the registry.

## Getting started {#before-you-begin}

Sign up for Yandex Cloud and create a [billing account](../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../billing/quickstart/index.md) and [link](../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../resource-manager/concepts/resources-hierarchy.md).

## Create a certificate {#create-ca}

X.509 certificates enable interaction between MQTT clients: the [registry](concepts/index.md#registry) and [device](concepts/index.md#device). Each of them needs its certificate.

* If you have certificates, add them to the MQTT clients. You can do this when creating clients.
* If you do not have certificates, create them using the [OpenSSL](https://www.openssl.org) program (the command below creates only one certificate):

    ```bash
    openssl req -x509 \
    -newkey rsa:4096 \
      -keyout private-key.pem \
      -out cert.pem \
      -nodes \
      -days 365 \
      -subj '/CN=localhost'
    ```

    Where:

    * `-x509`: Certificate type: X.509.
    * `-newkey`: Encryption algorithm.
    * `-keyout`: File with the certificate's private key.
    * `-out`: File with the certificate's public key.
    * `-nodes`: This flag is set when no public key encryption is required.
    * `-days`: Certificate validity period in days.
    * `-subj`: Request object.

   For each of the MQTT clients, specify different names for files with private and public keys.

## Create a registry {#create-registry}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder you want to create a registry in.
    1. Navigate to **IoT Core**.
    1. In the left-hand panel, select **Registries**.
    1. Click **Create registry**.
    1. Under **General information**, add `my-registry` as the registry name.
    1. Add a certificate:

        * To add a file:

            1. Select the `File` method.
            1. Click **Attach file**.
            1. Select the file with the public key of the certificate and click **Open**.
            1. Click **Add**.

        * To add text:

            1. Select the `Text` method.
            1. Paste the certificate's public key to the **Content** field.
            1. Click **Add**.

    1. Click **Create**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    1. Create a registry:

        ```bash
        yc iot registry create --name my-registry
        ```

        Result:

        ```text
        id: b91hafek85**********
        folder_id: aoek49ghmk*********
        created_at: "2019-05-27T13:40:06.923Z"
        name: my-registry
        status: ACTIVE
        log_group_id: ckghotead**********
        ```

    1. Add a certificate to the registry:

        ```bash
        yc iot registry certificate add \
           --registry-name my-registry \
           --certificate-file registry-cert.pem
        ```

        Where:

        * `--registry-name`: Registry name.
        * `--certificate-file`: Path to the certificate's public key.

        Result:

        ```text
        registry_id: b91hafek85**********
        fingerprint: 589ce16050****
        certificate_data: |
           -----BEGIN CERTIFICATE-----
           MIIE/jCCAuagAwIBAgIJAPRA...
           -----END CERTIFICATE-----
        created_at: "2019-05-27T13:41:45.295Z"
        ```

{% endlist %}

## Create a device {#create-device}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select a folder to create a device in.
    1. Navigate to **IoT Core**.
    1. Select `my-registry` from the list.
    1. Select **Devices** in the left pane of the window.
    1. Click **Add device**.
    1. Under **General information**, add `my-device` as the device name.
    1. Add a certificate:

        * To add a file:

            1. Select the `File` method.
            1. Click **Attach file**.
            1. Select the file with the public key of the certificate and click **Open**.
            1. Click **Add**.

        * To add text:

            1. Select the `Text` method.
            1. Paste the certificate's public key to the **Content** field.
            1. Click **Add**.

    1. Click **Create**.

- CLI {#cli}

    1. Create a device:

        ```bash
        yc iot device create \
          --registry-name my-registry \
          --name my-device
        ```

        Where:

        * `--registry-name`: Name of the registry the device is part of.
        * `--name`: Device name.

        Result:

        ```text
        id: b912an77oq**********
        registry_id: b91hafek85**********
        created_at: "2019-05-27T13:44:35.164Z"
        name: my-device
        ```

    1. Add a certificate to the device:

        ```bash
        yc iot device certificate add \
          --device-name my-device \
          --certificate-file ./certs/device-cert.pem
        ```

        Where:

        * `--device-name`: Device name.
        * `--certificate-file`: Path to the certificate's public key.

        Result:

        ```text
        device_id: b912an77oq**********
        fingerprint: 65e5b05006***
        certificate_data: |
           -----BEGIN CERTIFICATE-----
           MIIE/jCCAuagAwIBAgIJANZbq...
           -----END CERTIFICATE-----
        created_at: "2019-05-27T13:45:23.306Z"
        ```

{% endlist %}

## Set up message exchange between the device and the registry {#exchange}

1. [Subscribe a device or registry to receive messages](operations/subscribe.md).
1. [Send a message](operations/publish.md).

## What's next {#what-is-next}

* Read about [service concepts](concepts/index.md).
* Find out how to [work with registries and devices](operations/index.md).