Creating a registry
-
In the management console
, select the folder you want to create a registry in. -
Select IoT Core.
-
In the left-hand panel, select Registries.
-
Click Create registry.
-
Under General information, add:
-
Registry Name, e.g.,
my-registry
. -
(Optional) Description with additional information about the registry.
-
Password that you will use to access the registry. To create a password, you can use this password generator
.Note
Save the password as you will need it for authentication.
-
(Optional) To assign a label to the registry, fill in the Key and Value fields and click Add label.
-
-
(Optional) Add a certificate:
-
To add a file:
- Choose the
File
method. - Click Attach file.
- Select the file with the public key of the certificate and click Open.
- Click Add.
- Choose the
-
To add text:
- Choose the
Text
method. - Paste the certificate's public key to the Content field.
- Click Add.
- Choose the
-
-
Click Create.
If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.
The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
Create a registry:
yc iot registry create --name <registry_name>
The registry naming requirements are as follows:
- It must be from 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
Result:
id: b91hafek85********** folder_id: aoek49ghmk********* created_at: "2019-05-27T13:40:06.923Z" name: <registry_name> status: ACTIVE log_group_id: ckghotead**********
-
(Optional) Assign the registry a password for authentication with a username and password:
yc iot registry password add --registry-name <registry_name>
You will be prompted to enter a password. Password requirements:
- The password must contain numbers, upper-case and lower-case letters, and special characters.
- It must be at least 14 characters long.
Result:
registry_id: b91hafek85********** id: aoek49ghmk********* created_at: "2019-05-27T13:44:06.923Z"
-
(Optional) Add to the registry a certificate for authentication with certificates:
yc iot registry certificate add \ --registry-name <registry_name> \ --certificate-file <certificate>
Where:
--registry-name
: Registry name.--certificate-file
: Path to the public key of the certificate, such ascert.pem
.
Result:
registry_id: b91hafek85********** fingerprint: 589ce16050**** certificate_data: | -----BEGIN CERTIFICATE----- MIIE/jCCAuagAwIBAgIJAPRA... -----END CERTIFICATE----- created_at: "2019-05-27T13:41:45.295Z"
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the documentation on the Terraform
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
Note
To add certificates to a registry, generate them in advance.
To create a device registry:
-
In the configuration file, describe the parameters of the resource to create:
-
yandex_iot_core_registry
: Registry parameters:name
: Registry name.description
: Registry description.labels
: Registry labels inkey:value
format.passwords
: List of registry passwords for authentication with a username and password.certificates
: List of registry certificates for authentication with certificates.
Note
Make sure to use only one of the two authentication methods.
Here is an example of the resource structure in the configuration file:
resource "yandex_iot_core_registry" "my_registry" { name = "test-registry" description = "test registry for terraform provider documentation" labels = { test-label = "label-test" } passwords = [ "<password_1>", "<password_2>" ] certificates = [ file("<path_to_first_certificate_file>"), file("<path_to_second_certificate_file>") ] } output "yandex_iot_core_registry_my_registry" { value = "${yandex_iot_core_registry.my_registry.id}" }
For more information about the resources you can create with Terraform, see the relevant provider documentation
. -
-
Make sure the configuration files are correct.
-
In the command line, navigate to the directory where you created the configuration file.
-
Run a check using this command:
terraform plan
If you described the configuration correctly, the terminal will display a list of the resources being created and their settings. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy the cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm creating the resources.
This will create all resources you need in the specified folder. You can check your new resources and their settings in the management console
or using this CLI command:yc iot registry list
-
To create a registry, use the create REST API method for the Registry resource or the RegistryService/Create gRPC API call.