Before using the command-line interface (CLI), you must configure and check global information. For example, run the wpctl configure command to configure global information such as the AccessKey ID and AccessKey secret of your account and the language, run the wpctl doctor command to verify the permissions of your account, and run the wpctl init command to initialize the default region, application, and environment information in the current working directory.

Step 1: Configure global information

Run the wpctl configure command to configure global information such as the AccessKey ID and AccessKey secret of your account and the language.

Method 1: Run the following command to configure global information and create a profile named test. For more information about the Region ID, see Supported regions.

$ wpctl configure --profile test
Configuring profile 'test' in '' authenticate mode...
Access Key Id []: yourAk
Access Key Secret []: yourSk
Default Region Id []: cn-shenzhen                              
Default Output Format [json]: json (Only support json))
Default Language [zh|en] en: en

Saving profile[test] ...Done.
Configure Done!!!
$ webxctl configure list
Profile   | Credential         | Valid   | Region           | Language
--------- | ------------------ | ------- | ---------------- | --------
test *    | AK:***rAk          | Valid   | cn-shenzhen      | en

Method 2: Run the following command with full configuration:

$ wpctl configure -p test1 --access-key-id yourAk --access-key-secret yourSk --region cn-shenzhen --language en
Configuring profile 'test1' in '' authenticate mode...
Saving profile[test1] ...Done.
Configure Done!!!
$ wpctl configure list
Profile   | Credential         | Valid   | Region           | Language
--------- | ------------------ | ------- | ---------------- | --------
default   | AK:***zGQ          | Valid   | cn-shenzhen      | en
test1 *   | AK:***zGQ          | Valid   | cn-shenzhen      | en

Method 3: Configure the following environment variables:

ALICLOUD_ACCESS_KEY
ALICLOUD_SECRET_KEY
ALICLOUD_REGION

Switch the profile and modify parameters such as Region.

$ webxctl configure set --profile default --region cn-hangzhou
$ webxctl configure list
Profile   | Credential         | Valid   | Region           | Language
--------- | ------------------ | ------- | ---------------- | --------
default * | AK:***zGQ          | Valid   | cn-hangzhou      | en
jungle    | AK:***3M1          | Valid   | cn-shenzhen      | en
test      | AK:***rAk          | Valid   | cn-shenzhen      | en

Step 2: Verify the permissions of your account

Run the wpctl doctor command to verify the permissions of the current account. Check in sequence whether Web App Service (Web+) is activated, whether associated services are activated, and whether permissions to access your Alibaba Cloud resources are granted to roles related to Web+. You can use Web+ features only after your account passes the verification.

$ wpctl doctor
[OK] Describe aliyun authority (1s)
[Products related checked]
+----+------+------------------------+--------------------------------+--------+
| NO | NAME |         TITLE          |              DESC              | STATUS |
+----+------+------------------------+--------------------------------+--------+
|  1 | ESS  | Auto Scaling           | Elastic scaling (Auto ...      | OK     |
|  2 | OSS  | Object Storage Service | Massive, secure, ...           | OK     |
+----+------+------------------------+--------------------------------+--------+
[OK] Describe role status (1s)
[Role related checked]
+----+---------+---------------------------------+------------+
| NO | SERVICE |              ROLE               | AUTHORIZED |
+----+---------+---------------------------------+------------+
|  1 | WebPlus | AliyunWebPlusDefaultRole        | true       |
|  2 | ECS     | AliyunECSInstanceForWebPlusRole | true       |
+----+---------+---------------------------------+------------+
[doctor check ok, have fun]

Step 3: Select an application and a deployment environment

Run the wpctl init command to initialize the current working directory.

If no application is available in the selected region, you are prompted to create an application. The CLI displays all interactions in green. Generally, you only need to select a number or enter information as prompted.

$ wpctl init
1) cn-hangzhou
2) cn-shenzhen
Select a default region, default region is [2:cn-shenzhen]: 1                          
No application get
0) new a application
Select a default application, default is create a application [0:new a application]:0
You are going to create a application, please enter application name: demo-test
...
[OK] Create application demo-test
No environment to select
...
[wpctl init successed]

If an application already exists in the selected region, select the default deployment environment. The system saves the initialization result in the .webplus folder of the working directory.

$ webxctl init
...
0) new a application
1) demo-test2
2) demo-test1
Select a default application, default Application name [1:demo-test2]: 1
...
1) demo-test-env
Select a default environment, default environment [demo-test-env]: 1
Saving config to webxconfig:[/Users/***/Documents/webp/webp-cli-demo/.webplus/wpconfig.yaml