Creating a folder
A folder is a space where Yandex Cloud resources are created and grouped.
-
In the management console, select a cloud and click
Create folder.
-
Enter the folder name. Naming requirements:
- The length can be from 3 to 63 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
-
(Optional) Enter a description of the folder.
-
Select the Create a default network option. A network is created with subnets in each availability zone. A default security group, where all network traffic is allowed inside, will also be created in this network.
-
Click Create.
If you don't have the Yandex Cloud command line interface yet, install and initialize it.
-
See a description of the create folder command:
yc resource-manager folder create --help
-
Create a new folder:
-
with a name and without a description:
yc resource-manager folder create \ --name new-folder
- The length can be from 3 to 63 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
-
with a name and description:
yc resource-manager folder create \ --name new-folder \ --description "my first folder with description"
-
If you don't have Terraform, install it and configure the Yandex Cloud provider.
-
In the configuration file, describe the parameters of resources that you want to create:
-
cloud_id
: ID of the cloud where the folder will be created. Optional. By default, the value specified in the provider settings is used. -
name
: Name of the folder to be created. Required parameter. Naming requirements:- The length can be from 3 to 63 characters.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
-
description
: Folder description. Optional.
Example configuration file structure:
resource "yandex_resourcemanager_folder" "folder1" { cloud_id = "<cloud ID>" name = "<name of folder to be created>" description = "<folder description>" }
For more information about the parameters of the
yandex_resourcemanager_folder
resource in Terraform, see the provider documentation. -
-
Make sure that the configuration files are correct.
-
In the command line, go to the directory where you created the configuration file.
-
Check the configuration 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
If the configuration is described correctly, the terminal displays a list of created resources and their parameters. If there are errors in the configuration, Terraform points them out.
-
-
Deploy the cloud resources.
-
If the configuration doesn't contain any errors, run the command:
terraform apply
-
Confirm the resource creation: type
yes
in the terminal and press Enter.
The folder will be created in the specified cloud. You can use the management console or a CLI command to verify that the folder is there:
yc resource-manager cloud list
-