Creating a folder
A folder is a space where Yandex Cloud resources are created and grouped.
-
In the management console
, select the appropriate cloud from the list on the left. -
At the top right, click Create folder.
-
Enter the folder name. The naming requirements are as follows:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
-
(Optional) Enter a description of the folder.
-
Select Create a default network. This will create a network with subnets in each availability zone. Within this network, a default security group will be created, inside which all network traffic is allowed.
-
Click Create.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
-
View the 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 naming requirements are as follows:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot 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 the resources you want to create:
-
cloud_id
: ID of the cloud to create the folder in. This is an optional parameter. By default, the value specified in the provider settings is used. -
name
: Name of the folder being created. This is a required parameter. The naming requirements are as follows:- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
-
description
: Folder description. This is an optional parameter.
Here is an example of the configuration file structure:
resource "yandex_resourcemanager_folder" "folder1" { cloud_id = "<cloud_ID>" name = "<name_of_folder_being_created>" description = "<folder_description>" }
For more information about the
yandex_resourcemanager_folder
resource parameters in Terraform, see the relevant provider documentation . -
-
Make sure the configuration files are correct.
-
In the command line, go to the folder where you created the 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
If the configuration is described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm creating the resources: type
yes
in the terminal and press Enter.
The folder will be created in the specified cloud. You can check the new folder and its settings using the management console
or this CLI command:yc resource-manager cloud list
-
To create a folder, use the create REST API method for the Folder resource or the FolderService/Create gRPC API call.