Creating a profile
There are two ways to create a profile:
-
Creating an empty profile and adding parameters manually.
This creates and activates an empty profile: you have to add all the parameters separately.
-
Wizard-based profile creation with basic parameters.
The CLI suggests setting the basic profile parameters step-by-step. You can use this method to redefine the parameters of an existing profile.
Creating an empty profile and adding parameters manually.
Create a profile with the test
name:
-
Run the command:
$ yc config profile create test Profile 'test' created and activated
-
Add the necessary profile parameters, such as a folder:
$ yc config set folder-id <folder ID>
View the full list of parameters of the profile and ways to manage them.
Wizard-based profile creation with basic parameters
If you use the wizard to create a profile, the CLI prompts you to enter the basic profile parameters step-by-step:
- Profile name.
- OAuth token.
- The cloud you have access rights to.
- Default folder.
- Default availability zone where Yandex Compute Cloud resources are created.
You can stop profile creation at any time. All the settings you entered before stopping are saved to the profile.
Get an OAuth token
Get an OAuth token: click Allow in Yandex.OAuth.
Create a profile
To create a profile:
-
Execute the
yc init
command. -
Enter your OAuth token:
You only have to do this your first time running the command
yc init
.Please go to https://oauth.yandex.com/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb in order to obtain OAuth token. Please enter OAuth token: AaAaBbBbCcCcDdDdEeEeFfFfGgGg
-
Choose an action: create a new profile or update the parameters of the current profile.
When the CLI installation is complete, you already have the
default
profile. The CLI prompts you to create a new profile or edit the parameters of the current profile.Welcome! This command will take you through the configuration process. Pick desired action: [1] Re-initialize this profile 'default' with new settings [2] Create a new profile
Depending on the option you choose, you are prompted for the profile name or OAuth token, respectively.
-
Enter a name for the new profile:
Enter profile name. Names start with a lower case letter and contain only lower case letters a-z, digits 0-9, and hyphens '-':
-
Enter your OAuth token:
Please go to https://oauth.yandex.com/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb in order to obtain OAuth token. Please enter OAuth token: AaAaBbBbCcCcDdDdEeEeFfFfGgGg
-
At the command prompt, select one of the clouds from the list of those you have access to:
Please select cloud to use: [1] cloud1 (id = aoe2bmdcvatao4frg22b) [2] cloud2 (id = dcvatao4faoe2bmrg22b) Please enter your numeric choice: 2
-
Select the default folder:
Please choose a folder to use: [1] folder1 (id = cvatao4faoe2bmdrg22b) [2] folder2 (id = tao4faoe2cvabmdrg22b) [3] Create a new folder Please enter your numeric choice: 1
-
Select the default availability zone for Yandex Compute Cloud:
Do you want to configure a default Yandex Compute Cloud availability zone? [Y/n] Y Which zone do you want to use as a profile default? [1] ru-central1-a [2] ru-central1-b [3] ru-central1-c [4] Don't set default zone Please enter your numeric choice: 2
View your profile settings
Run the command:
$ yc config profile get <profile name>
token: AQAAAAAV6O...
cloud-id: b1gvl...
folder-id: b1g88...