Install and configure ECI-Client
ECI-Client is a command-line client built on the Alibaba Cloud SDK. Use it to quickly create and manage ECI resources.
Background information
If you need to build cluster services, the recommended way to use ECI is through an ACK cluster or an ACK Serverless cluster, which takes full advantage of ECI. However, if your business scale is small, for example when you need to deploy only a few standalone applications, using ECI through ECI-Client is more convenient. ECI-Client provides the same syntax as Docker to manage ECI instances. If you are familiar with the Docker command line, you can quickly get started with ECI-Client. For more information, see Scenarios and ECI-Client.
Install ECI-Client
ECI-Client supports Linux and macOS, but does not support Windows.
Open a local terminal window and run the following command to install ECI-Client:
sudo bash -c "$(curl -s https://eci-docs.oss-cn-beijing.aliyuncs.com/eci-client/1.8.0/install.sh)"
Initialize the configuration
The first time you use ECI-Client, you need to configure the Alibaba Cloud AccessKey, region, and network-related parameters.
-
AccessKey: abbreviated as AK, is a permanent access credential that Alibaba Cloud provides to users. An AccessKey includes an AccessKey ID and an AccessKey secret. For information about how to obtain an AccessKey, see Create an AccessKey.
-
Region ID: ECI instances and related resources are created in the configured region. Select an appropriate region based on factors such as the geographic locations of you and your target users, and the resource prices. For more information, see Regions and zones.
-
Network-related parameters: include the VPC, vSwitch, and security group configurations. ECI instances and related resources are created in the configured VPC and vSwitch, and are added to the specified security group.
Initialize the configuration in one of the following ways:
(Recommended) eci config init
-
Initialize the configuration.
eci config init -
Follow the prompts to configure the AccessKey, region, and network-related parameters.
The following is an example:
INFO[0000] The command creates a configuration file. Please enter the configuration file path, the default is: ~/.eci/.ossutilconfig. Pressing Enter will use the default configuration file. If you sets it to another file, the --config-file option must be set to that file when using the following commands. INFO[0013] [Common configuation] INFO[0013] Please enter context name (default is default): cli-context INFO[0021] Please enter AccessKey: LTAI4G28PhwnizaSCb****** INFO[0089] Please enter AccessSecret: HAeSneamWifMyvgXq7yN********** INFO[0097] Please enter region-id (default is cn-hangzhou): cn-beijing INFO[0103] [Newwork configuation]: INFO[0103] Use a default network configuration suit (include vpc/vsw/security_group) [Y/N], default Y: N INFO[0127] Find a available network configuration suit (vpc/vsw/security_group) in cn-beijing [Y/N], default Y: N WARN[0143] Skip to find a available network configuration suit (vpc/vsw/security_group) in cn-beijing INFO[0143] Create a new network configuration suit (vpc/vsw/security_group) in cn-beijing [Y/N], default Y: N INFO[0149] Skip to create a new network configuration in cn-beijing, custom configuration is used INFO[0149] Please enter VSwitchId: vsw-2ze23nqzig8inpr****** INFO[0188] please enter SecurityGroupId: sg-2zeap5lrqnzbyn****** INFO[0209] Init successfully, current context has been switch to default
eci config set-context
-
If you need to specify network resources such as vSwitches and security groups
eci config set-context \ --access-key-id xxxxxx \ --access-secret xxxxxx \ --region-id cn-hangzhou \ --security-group-id sg-xxx \ --v-switch-id vsw-xxx -
If you do not have network resources such as vSwitches and security groups
-
The following command first attempts to find available vSwitch and security group configurations within the region. If none exist, it automatically creates a default vSwitch and a default security group.
eci config set-context \ --access-key-id xxxxxx \ --access-secret xxxxxx \ --region-id cn-hangzhou \ --init \ --context cli-context -
The following command uses the default network configuration managed by ECI. You cannot configure network routes and security policies yourself.
eci config set-context \ --access-key-id xxxxxx \ --access-secret xxxxxx \ --context cli-context
-
-
If you need to access the Internet, create an Internet NAT gateway in the VPC. For instructions, see Connect to the Internet.
-
If you need public network access to ECI instances, you must add the corresponding inbound security group rules. For instructions, see Add a security group rule.
Manage configurations
After you complete the initialization, you can use the following commands to manage configurations, including viewing, modifying, deleting, and switching configurations:
eci config [command]
|
command |
Description |
|
current-context |
Displays the current configuration. |
|
view |
Displays all configurations. |
|
init |
Initializes a new configuration. |
|
delete-context |
Deletes a configuration. By default, the current configuration is deleted. Use |
|
set-context |
Sets a configuration. By default, the current configuration is overwritten. Use |
|
use-context [context-name] |
Switches the configuration in use. |