AlibabaCloud Resourcify CLI (ARC)
ARC is a brand-new Alibaba Cloud CLI environment oriented to resourceization, and is a collection of multiple command line tools.
Installation
Please confirm that you have a Node.js development environment before installation. You can find it from https://nodejs.org/
Install ARC using the following command:
npm i @alicloud/arc -g
The currently included command line tools are as follows:
arc
: call all Alibaba Cloud resource commands supported by ARCarc <product> <resource> <action> [options]
arc-tool
: call related commands of ARC itselfarc-tool <command> [subCommand] [options]
arc-cs
: call CS related resource commandsarc-cs <resource> <action> [options]
arc-display
: support query results with jmespath and custom output formatarc-display --query <query> --format <format>
Global options
profile
: Specify the current profile nameinteraction
: Use interactive mode to fill commandsregion
: Specify Alibaba Cloud region
ARC configuration
Before using ARC to operate Alibaba Cloud resources, you need to configure the ARC related environment.
The default path of the ARC configuration file is:
$HOME/.aliyun/arc.json
Configure credentials
ARC currently supports AK and StsToken certificates. The corresponding fields of each type are as follows:
-
AK certificate:
access_key_id
: Credential IDaccess_key_secret
: credential secret -
StsToken certificate:
access_key_id
: Credential IDaccess_key_secret
: credential secretsts_token
: certificate token
Quickly configure AK credentials:
arc-tool config --access-key-id accessKeyId --access-key-secret accessKeySecret --region region
ARC configures AK credentials by default. If you need other credentials, please use the subcommand of config
to operate the arc configuration to add or delete necessary fields. If you change the default configuration to StsToken credentials:
arc-tool config set access_key_id <value>
arc-tool config set access_key_secret <value>
For more configuration related commands, please use the configuration help command: arc-tool config help
Use help information
ARC has built-in help information for all commands and their parameters. You can add the help
command after the command to get help information for related commands, for example:
- Obtain the operational resource information of CS products supported by ARC:
arc cs help
orarc-cs help
- Obtain the related operations of the cluster resource of CS product supported by ARC:
arc cs cluster help
orarc-cs cluster help
- Get configuration related operations supported by ARC:
arc-tool help
Use interactive mode
All ARC tools can use interactive mode to fill in command parameters.
Enable
Add -i
or --interaction
after any command to enable interactive mode. And at the end of the configuration, the complete related commands are printed, which is convenient for users to continue to use later. Finally, the user can choose whether to directly run the command just filled.
Use interactive input to configure the test configuration:
$ arc-tool config -i --profile test
? Access Key ID
access-key-id <accessKeyId>
? Access Key Secret
access-key-secret <accessKeySecret>
? the ID of the region
region cn-hangzhou
? the language of CLI
language en
Advantage
ARC has powerful advantages for complex command parameters and can assist user input in many ways:
The following examples are all cut from the same command: arc-cs cluster create -i
Angle brackets indicate user input
- Prompt for parameter input and supplemented by parameter description, the user does not need to remember:
? The name of the key pair.
key-pair <keyPair>
- Prompt for conflicting parameters
? The following options conflict, please select one (Use arrow keys)
❯ login-password
key-pair
- Basic parameter type check
? The system disk size of a worker node. Unit: GiB.
worker-system-disk-size <string>
>> Value is not of type Number
- The parameter value has an optional range, and the arrow is convenient for users to choose
? the type of the data disks
category (Use arrow keys)
❯ cloud
cloud_efficiency
cloud_ssd
[UNSET]
- Optional flags to reduce user input time
? Please select optional configuration or end configuration (Use arrow keys)
❯ region [string] The ID of the region where the cluster is deployed.
cluster-type [string] The type of the cluster
name [string] The name of the cluster. The name can contain uppercase letters, lowercase letters, Chinese characters, digits, and hyphens (-).
container-cidr [string] The CIDR block of containers. This CIDR block cannot overlap with that of the VPC. If the VPC is automatically created by the system, t
he CIDR block of containers is set to 172.16.0.0/16.
cloud-monitor-flags [boolean] Specifies whether to install the CloudMonitor agent.
disable-rollback [boolean] Specifies whether to retain all resources if the operation fails. Valid values:
true: retains the resources.
false: releases the resources.
Default value: true. We recommend that you use the default value.
(Move up and down to reveal more choices)
- Prompt the user to select a precondition
? Please select optional configuration or end configuration worker-data-disks
worker-data-disks
This parameter must meet the following conditions to be effective
When the value of worker-data-disk is equal to true
- Prompt input for complex parameter value structure
# map type parameter value
? Please select optional configuration or end configuration runtime
runtime
The runtime of containers. Default value: docker. Specify the runtime name and
version.
? runtime name
runtime.name <runtime.name>
? runtime version
runtime.version <runtime.version>
# For array parameter values
? Please select optional configuration or end configuration pod-vswitch-ids
pod-vswitch-ids
Pod VSwitch IDs, in ENI multi-network card mode, you need to pass additional
vswitchid to addon. When creating a cluster of the terway network type, this
field is required.
? Pod VSwitch IDs, in ENI multi-network card mode, you need to pass additional vswitchid to addon. When creating a cluster of the terway network type, this field
is required.
pod-vswitch-ids.0 <pod-vswitch-ids.0>
? Whether to continue to configure the 2 pod-vswitch-ids Yes
? Pod VSwitch IDs, in ENI multi-network card mode, you need to pass additional vswitchid to addon. When creating a cluster of the terway network type, this field
is required.
pod-vswitch-ids.1 <pod-vswitch-ids.1>
License
The Apache License 2.0. See Apache-2.0
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.