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:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
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
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 CLI yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder through the --folder-name
or --folder-id
parameter.
-
Create a broker:
yc iot broker create --name my-broker
Result:
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.pem
Where:
--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.