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.
-
Give your folder a name. The naming requirements are as follows:
- It must be from 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 the description for your folder.
-
Select Create a default network. This will create a network with subnets in each availability zone. Within this network, you will also have a default security group, inside which all network traffic will be allowed.
-
Click Create.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
-
Read the
create folder
command description: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
Follow these naming requirements:
- It must be from 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.
-
with a name and description:
yc resource-manager folder create \ --name new-folder \ --description "my first folder with description"
-
If you do not have Terraform yet, install it and configure its Yandex Cloud provider.
-
In the configuration file, describe the resources you want to create:
-
cloud_id
: ID of the cloud to create the folder in. This is an optional parameter. The default value in use is the one specified in the provider settings. -
name
: Name of the new folder. This is a required setting. Follow these naming requirements:- It must be from 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.
-
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_the_new_folder>" description = "<folder_description>" }
For more information about the
yandex_resourcemanager_folder
parameters in Terraform, see the relevant Terraform article . -
-
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 you described the configuration correctly, the terminal will display a list of the resources being created and their settings. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy the cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm the creation of the resources: in the terminal, type
yes
and press Enter.This will create the folder in the specified cloud. You can check the new folder and its settings using the management console
or this CLI command:yc resource-manager folder list
-
To create a folder, use the create REST API method for the Folder resource or the FolderService/Create gRPC API call.