Creating a registry
-
In the management console
, select the folder to create your 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 the 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 public key of the certificate to the Content field.
- Click Add.
- Choose the
-
-
Click Create.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. 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:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be 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 using 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 a certificate to the registry for authentication using 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"
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the 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 namedescription
: Registry descriptionlabels
: Registry labels inkey:value
formatpasswords
: List of registry passwords for authentication using a username and password.certificates
: List of registry certificates for authentication using 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 resources you can create with Terraform, see the provider documentation
. -
-
Make sure the configuration files are correct.
-
In the command line, go to the folder where you created the configuration file.
-
Run a check using this command:
terraform plan
If the configuration is described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm that you want to create the resources.
All the resources you need will then be created in the specified folder. You can check the new resources and their configuration using the management console
or 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.