Creating a placement group
Create a placement group.
You can manage placement groups with partition placement using the CLI and API.
-
In the management console
, select the folder to create your placement group in. -
In the list of services, select Compute Cloud.
-
In the left-hand panel, select
Placement groups. -
Go to the Virtual machine placement groups tab.
-
In the top-right corner, click Create and select Virtual machine placement group.
-
Enter a name for the placement group. The naming requirements are as follows:
- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Optionally, specify a description for the placement group.
-
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.
-
See the description of the CLI command for creating a placement group:
yc compute placement-group create --help
-
Create a placement group in the default folder with one of the following placement strategies:
-
yc compute placement-group create \ --spread-strategy \ --name <placement_group_name>
Where:
--spread-strategy
: Shows that spread placement is selected.--name
: Placement group name.
-
yc compute placement-group create \ --partitions <number_of_partitions> \ --name <placement_group_name>
Where:
--partitions
: Shows that partition placement is selected, indicating the number of partitions from1
to5
.--name
: Placement group name.
-
-
Check that the placement group has been added:
yc compute placement-group list
Result:
+----------------------+----------+----------+ | ID | NAME | STRATEGY | +----------------------+----------+----------+ | fd83bv4rnsna******** | my-group | SPREAD | +----------------------+----------+----------+
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.
-
In the configuration file, define the placement group parameters:
-
name
: Placement group name. The name format is as follows:- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
folder_id
: ID of the folder to create a placement group in. -
description
: Placement group description.
Here is an example of the configuration file structure:
resource "yandex_compute_placement_group" "group1" { name = "<placement_group_name>" folder_id = "<folder_ID>" description = "<placement_group_description>" }
For more information about the
yandex_compute_placement_group
resource parameters in Terraform, see the relevant provider documentation . -
-
In the command line, go to the directory with the Terraform configuration file.
-
Check the configuration 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
The terminal will display a list of resources with their parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.All the resources you need will then be created in the specified folder. You can check the new resources and their settings using the management console
or this CLI command:yc compute placement-group list
Use the create REST API method for the PlacementGroup resource or the PlacementGroupService/Create gRPC API call.