Getting started with Yandex IoT Core brokers
To get started with Yandex IoT Core:
Note
The broker is at the Preview stage.
Getting started
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can navigate to the cloud page
Learn more about clouds and folders here.
Create a certificate for the broker
If you have a certificate, add it to the broker after creation. If you do not have a certificate, create it using the OpenSSL
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 private key of the certificate.-out: File with the public key of the certificate.-nodes: This flag is set when no public key encryption is required.-days: Certificate validity period in days.-subj: Request object.
Create a broker
-
In the management console
, select the folder where you want to create a broker. -
Select IoT Core.
-
In the left-hand panel, select Brokers.
-
Click Create broker.
-
Under General information, specify the broker name:
my-broker. -
Add a certificate:
-
To add a file:
- Choose the
Filemethod. - 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
Textmethod. - 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 CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
Create a broker:
yc iot broker create --name my-brokerResult:
id: b91ki3851h********** folder_id: aoek49ghmk********* created_at: "2022-05-28T11:29:42.420Z" name: my-broker status: ACTIVE -
Add the certificate to the broker:
yc iot broker certificate add \ --broker-name my-broker \ --certificate-file cert.pemWhere:
--broker-name: Broker name--certificate-file: Path to the public key of the certificate.
Result:
broker_id: b91ki3851h********** fingerprint: 1f21cf6d0183d**** certificate_data: | -----BEGIN CERTIFICATE----- MIIEpDCCAow... -----END CERTIFICATE----- created_at: "2023-07-11T16:20:53.466370019Z"
Set up message exchange
What's next
- Read about service concepts.
- Learn how to work with brokers.