Creating a bus
-
In the management console
, select the folder where you want to create a bus. -
Select Serverless Integrations.
-
In the left-hand panel, select
EventRouter. -
In the top-right corner, click Create bus. In the window that opens:
-
Enter a name and description for the bus. Follow these naming requirements:
- The name must be from 3 to 63 characters long.
- It may contain uppercase and lowercase Latin and Cyrillic letters, numbers, hyphens, underscores, and spaces.
- The first character must be a letter. The last character cannot be a hyphen, underscore, or space.
-
Optionally, add labels:
- Click Add label.
- Enter a label in
key: value
format. - Press Enter.
-
Optionally, enable deletion protection. You cannot delete a bus with this option enabled.
-
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.
-
View the description of the CLI command to create a bus:
yc serverless eventrouter bus create --help
-
Create a bus:
yc serverless eventrouter bus create \ --name <bus_name> \ --description "<description>" \ --labels <label_list> \ --deletion-protection
Where:
-
--name
: Bus name. Follow these naming requirements:- The name must be from 3 to 63 characters long.
- It may contain uppercase and lowercase Latin and Cyrillic letters, numbers, hyphens, underscores, and spaces.
- The first character must be a letter. The last character cannot be a hyphen, underscore, or space.
-
--description
: Bus description. This is an optional parameter. -
--labels
: List of labels. This is an optional parameter.You can specify one or more labels separated by commas in
<key1>=<value1>,<key2>=<value2>
format. -
--deletion-protection
: Bus deletion protection. By default, protection is disabled. You cannot delete a bus with this option enabled. To disable deletion protection, specify--no-deletion-protection
. This is an optional parameter.
Result:
id: f66aevm4ithv******** folder_id: b1g681qpemb4******** cloud_id: b1gia87mbaom******** created_at: "2025-02-13T12:36:59.497985Z" name: my-bus-43 description: this is my bus labels: owner: admin deletion_protection: true status: ACTIVE
-
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To create a bus:
-
In the configuration file, define the parameters of the resources you want to create:
resource "yandex_serverless_eventrouter_bus" "example_bus" { name = "<bus_name>" description = "<description>" deletion_protection = <true|false> labels = { <key_1> = "<value_1>" <key_2> = "<value_2>" ... <key_n> = "<value_n>" } }
Where:
-
name
: Bus name. Follow these naming requirements:- The name must be from 3 to 63 characters long.
- It may contain uppercase and lowercase Latin and Cyrillic letters, numbers, hyphens, underscores, and spaces.
- The first character must be a letter. The last character cannot be a hyphen, underscore, or space.
-
description
: Bus description. This is an optional parameter. -
deletion-protection
: Bus deletion protection,true
orfalse
. You cannot delete a bus with this option enabled. This is an optional parameter. -
labels
: List of labels. Provide labels in<key> = "<value>"
format. This is an optional parameter.
For more information about the
yandex_serverless_eventrouter_bus
resource parameters, see the provider documentation . -
-
Create the resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
Run this command:
terraform plan
You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply
-
Type
yes
and press Enter to confirm the changes.
Terraform will create all the required resources. You can check the new resources using the management console
or this CLI command:yc serverless eventrouter bus list
-
To create a bus, use the Create REST API method for the Bus resource or the Bus/Create gRPC API call.