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 Russian 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 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
parameters.
-
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 Russian 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 documentation on the Terraform
If you don't have Terraform, 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 Russian 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, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
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.