You can use the EASCMD client to manage services in Elastic Algorithm Service (EAS) of Platform for AI (PAI). You can run commands to create services, update services, view service details, and manage stress testing tasks. This topic describes the commands that are supported by the EASCMD client and provides sample commands.
Operation commands
The following table describes the features that the EASCMD command-line tool provides for you to manage services.
When you use the EASCMD client to run commands, the specific client name used in the commands may vary. The actual name prevails.
Type | Operation | Description |
Service-related | You can use one of the following methods to use the EASCMD command-line tool:
| |
Resource group-related |
Create a service
Description
You can run the
createcommand to create a service. When you create a service, you must provide the HTTP or OSS URL of a resource, which can be a model or processor package. You can upload the resource to Object Storage Service (OSS) and obtain the OSS URL of the uploaded package.Syntax
<eascmd64> create <service_desc_json>Parameters
service_desc_json: a JSON file that describes the service information, such as the directory in which the input model package is stored and the resource specifications. The following information provides an example of the JSON file:
{ "name": "mnist_saved_model_example", "model_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/models%2Fmnist_saved_model.tar.gz", "processor": "tensorflow_cpu_1.12", "metadata": { "instance": 1, "cpu": 1 } }For more information about the service parameters in the JSON file, see JSON deployment.
Example (In this example, the JSON file that describes the service information is named pmml.json.)
<eascmd64> create pmml.jsonThe system returns information similar to the following output:
[RequestId]: 1651567F-8F8D-4A2B-933D-F8D3E2DD**** +-------------------+----------------------------------------------------------------------------+ | Intranet Endpoint | http://pai-eas-vpc.cn-shanghai.aliyuncs.com/api/predict/savedmodel_example | | Token | YjQxZDYzZTBiZTZjMzQ5ZmE0MzczZjIxMGZiNzZmMDBkY2VjMDg4**** | +-------------------+----------------------------------------------------------------------------+ [OK] Creating api gateway [OK] Building image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_cn-shanghai:v0.0.1-20190224001315] [OK] Pushing image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_cn-shanghai:v0.0.1-20190224001315] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Service is running
Modify service configurations
Description
You can use the
-Doption in themodifycommand to modify the metadata such as the number of instances and CPU quota.Syntax
<eascmd64> modify <service_name> -Dmetadata.<attr_name>=<attr_value>You can set multiple parameters at a time. For more information, see the following example.
Parameters
<service_name>: the name of the service.
<attr_name>: the name of the parameter.
<attr_value>: the value of the parameter.
Example
Set the number of instances to 10 and the quota for each instance to 5 (including 5 vCPUs and 20 GB of memory).
<eascmd64> modify service_test -Dmetadata.instance=10 -Dmetadata.cpu=5When you scale resources, you can modify only the value of the metadata.instance parameter of the service. If the specified number of instances is greater than the number of existing instances for the service, the system starts new instances to reach the specified number without affecting existing instances. If the specified number of instances is smaller than the number of existing instances, the system stops specific instances to reach the specified number without affecting other service instances.
NoteDifferent from a full update operation, an update operation that modifies only the number of instances does not trigger a rolling update for the service.
Modify a service
Description
You can run the
modifycommand to modify a deployed service.Syntax
<eascmd64> modify <service_name> -s <service_desc_json>Parameters
<service_name>: the name of the service.
<service_desc_json>: the description file of the service.
NoteWhen you modify a service, you can modify only the parameters that you want to modify in the description file of the service and leave other parameters unchanged. If you modify the model file information and processor information, a new service version is added.
Add a version for a service
Description
You can run the
modifycommand to add a version for a deployed service.Syntax
<eascmd64> modify <service_name> -s <service_desc_json>Parameters
<service_name>: the name of the service.
<service_desc_json>: the description file of the service.
NoteTo add a version for a service, you must specify the model file information and processor information in the description file of the service.
Stop a service
Description
You can run the
stopcommand to stop a running service.Syntax
<eascmd64> stop <service_name>Parameters
<service_name>: the name of the service that you want to stop.
Start a service
Description
You can run the
startcommand to restart a stopped service.Syntax
<eascmd64> start <service_name>Parameters
<service_name>: the name of the service that you want to start.
Delete a service
Description
You can run the
deletecommand to delete a service in the current region.Syntax
<eascmd64> delete <service_name>Parameters
<service_name>: the name of the service that you want to delete.
Example
In this example, the service name is savedmodel_example. To delete the service, perform the following steps:
Run the following command to delete the service:
<eascmd64> delete savedmodel_exampleThe system returns information similar to the following output:
Are you sure to delete the service [savedmodel_example] in [cn-shanghai]? [Y/n]Press the Y key. The system returns information similar to the following output:
[RequestId]: 1651567F-8F8D-4A2B-933D-F8D3E2DD**** [OK] Service [savedmodel_example] in region [cn-shanghai] is terminating [OK] Service is terminating [OK] Service is terminating [OK] Service was deleted successfully
Switch between service versions
Description
You can run the
desccommand to view the current version and the latest version of a service. Then, run theversioncommand to switch to a version earlier than the latest version.Syntax
<eascmd64> version <service_name> <version_id>Parameters
<service_name>: the name of the service.
<version_id>: the ID of the version to which you want to switch.
View the service list
Description
You can run the
listorlscommand to view the services that are deployed within the current account.Syntax
<eascmd64> lsParameters
N/A
Example
<eascmd64> lsThe system returns information similar to the following output:
[RequestId]: 83945D4E-ED3E-4D35-A989-831E36BB**** +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+ | SERVICENAME | REGION | INSTANCE | CREATETIME | UPDATETIME | STATUS | WEIGHT | SERVICEPATH | +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+ | mnist_saved_model_example | cn-shanghai | 1 | 2019-02-21 16:35:41 | 2019-02-21 16:35:41 | Running | 0 | /api/predict/mnist_saved_model_example | +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+
View the details of a service
Description
You can run the
desccommand to view the details of a deployed service.Syntax
<eascmd64> desc <service_name>Parameters
<service_name>: the name of the service.
Example
<eascmd64> desc mnist_saved_model_exampleThe system returns information similar to the following output:
+---------------------+--------------------------------------------------------------------------------------------------------------+ | Status | Running | | ServiceName | mnist_saved_model_example | | Region | cn-shanghai | | CreateTime | 2019-02-21 16:35:41 | | UpdateTime | 2019-02-21 16:35:41 | | AccessToken | | | PrivateToken | ZWNjMTNkNDExMmExNjZkYTM4YWQ5YTY0YmFjNjk3YWYzZTRjM2Y2**** | | TotalInstance | 1 | | RunningInstance | 1 | | PendingInstance | 0 | | CPU | 1 | | GPU | 0 | | Memory | 1000M | | Image | registry-vpc.cn-shanghai.aliyuncs.com/eas/mnist_saved_model_example_cn-shanghai:v0.0.1-20190221163541 | | Weight | 0 | | LatestVersion | 1 | | CurrentVersion | 1 | | Message | Service start successfully | | APIGatewayUrl | 1c3b37ea83c047efa0dc6df0cacb****-cn-shanghai.alicloudapi.com/EAPI_182848887922****_mnist_saved_model_example | | APIGatewayAppKey | 2564**** | | APIGatewayAppSecret | 12562a7b8858bbba2c2e9c4517ff**** | | IntranetEndpoint | http://pai-eas-vpc.cn-shanghai.aliyuncs.com/api/predict/mnist_saved_model_example | | ServiceConfig | { | | | "generate_token": "false", | | | "metadata": { | | | "cpu": 1, | | | "instance": 1, | | | | "region": "cn-shanghai" | | | }, | | | "model_path": | | | "http://eas-data.oss-cn-shanghai.aliyuncs.com/models%2Fmnist_saved_model.tar.gz", | | | "name": | | | "mnist_saved_model_example", | | | "processor": | | | "tensorflow_cpu" | | | } | +---------------------+--------------------------------------------------------------------------------------------------------------+
View service process
Description
You can run the
showworkers(w)orwcommand to view the status of the processes that are running in a service.Syntax
<eascmd64> w <service_name>Parameters
<service_name>: the name of the service.
Example
<eascmd64> w mnist_saved_model_exampleThe system returns information similar to the following output:
[RequestId]: B23BA8AC-CDEC-5704-935F-3CEC6606**** +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+ | INSTANCENAME | INNERIP | HOSTIP | STARTAT | RESTARTS | STATUS | READY | REASON | LASTSTATE | +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+ | network-test-69cf5dd6c7-5**** | 10.240.XX.XX | 10.224.XX.XX | 2021-09-27 15:04:22 | 1 | Running | [1/1] | | {"exitCode":247,"finishedAt":"2021-09-27T07:04:21Z","reason":"Error","startedAt":"2021-09-27T05:36:56Z"} | +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+The following table describes the parameters in the output.
Parameter
Description
INSTANCENAME
The name of the instance that runs the service.
INNERIP
The internal IP address of the instance.
HOSTIP
The IP address of the node to which the instance belongs.
STARTAT
The start time of the instance.
RESTARTS
The number of times that the instance restarted. The instance automatically restarts each time an Out of Memory (OOM) error or a crash caused by code errors occurs. Each time the instance is restarted, the value of the RESTARTS parameter increases by one.
STATUS
The status of the instance. A value of Pending indicates that the instance is waiting for resources. If the instance remains in the Pending state for a large amount of time, the instance cannot be used to run the service because of insufficient resources.
READY
The status of the containers in the instance. The value is in the format of
[Number of containers that are ready/Total number of containers in the instance].If the value of the READY parameter is [0/1], the container is starting or the container failed the health check. In this case, traffic does not go to the instance.
If the parameter value is [0/1] for all instances of a service, the service is unavailable and a
5xxerror code is returned when the service is requested.REASON
The description of the instance status.
LASTSTATE
The status of the instance after the last restart. If the value of the reason field in the LASTSTATE parameter is OOMKIlled, an OOM error occurs on the instance.
Create a stress testing task
Description
You can run the
bench createcommand to create a stress testing task for a deployed service.Syntax
<eascmd64> bench create <bench_desc_json>Parameters
bench_desc_json: the JSON file of the task. Sample file content:
{ "service": { "serviceName": "servicename_example" }, "data": { "content": "W1sxLDAsMCwwLDEsMSwwLDEsMCwxLDEsMCwwLDEsMCwxLDAsMSwwLDAsMSwxLDEsMCwxLDEsMCwwLDAsMSwxLDEsMCwxLDEsMSwxLDAsMSwxLDEsMCwxLDAsMCwwLDEsMSwwLDAsMCwxLDAsMSwwLDEsMCwwLDEsMCwwLDEsMCwxLDAsMCwxLDAsMCwwLDAsMSwwLDEsMCwxLDAsMCwxLDEsMSwwLDAsMSwwLDAsMCwwLDEsMSwxLDAsMSwxLDAsMCwxLDAsMSwwLDEsMSwxLDEsMCwxLDAsMCwxLDEsMSwxLDAsMCwwLDEsMSwwXV0K" } }You can add the path parameter to the file to specify multiple OSS objects as the stress testing data. The following syntax provides a sample file content. To specify multiple stress testing data entries, add the entries to a compressed zip file and then specify the OSS path of the file in the oss://XX.zip format in the JSON file.
{ "service": { "serviceName": "servicename_example" }, "data": { "path": "oss://examplebucket/test1.bin,oss://examplebucket/test2.bin" } }For more information about the parameters in the JSON file, see Create a stress testing task.
Example (In this example, the JSON file that describes the task information is named bench.json.)
<eascmd64> bench create bench.jsonThe system returns information similar to the following output:
[RequestId]: DE240637-4976-59AF-A28C-BAA55C0A**** [OK] Task [benchmark-servicename-example-b514] is creating [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 1/1]: Benchmark task is Running [OK] Benchmark task is Running [OK] Click the link http://127.0.0.1:18222/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-servicename-example-b514
Manage stress testing tasks
View stress testing tasks
Description
You can run the
bench listcommand (orbench ls) to view the stress testing tasks created by the current user.Syntax
<eascmd64> bench lsParameters
N/A
Example
<eascmd64> bench lsThe system returns information similar to the following output:
[RequestId]: 7F953F8E-8897-5785-808A-CA648302**** +-------------------------+--------------------------+-------------+----------------+---------+---------------------+ | TASKNAME | TASKID | REGION | AVAILABLEAGENT | STATUS | CREATETIME | +-------------------------+--------------------------+-------------+----------------+---------+---------------------+ | benchmark-xgb-test-7846 | eas-b-ql470xog6qeh25**** | cn-shanghai | 0 | Stopped | 2022-06-17 17:58:01 | | benchmark-xgb-test-b514 | eas-b-bdnzvwq0z0h3xq**** | cn-shanghai | 2 | Running | 2022-06-20 12:18:54 | +-------------------------+--------------------------+-------------+----------------+---------+---------------------+
View the details of a stress testing task
Description
You can run the
bench desccommand to view the details of a stress testing task.Syntax
<eascmd64> bench desc <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench desc benchmark-demo-test-c7ebThe system returns information similar to the following output:
+----------------+------------------------------------------------------------------------------+ | TaskName | benchmark-xgb-test-b514 | | TaskId | eas-b-bdnzvwq0z0h3xq**** | | ServiceName | xgb_test | | Region | cn-shanghai | | DesiredAgent | 2 | | AvailableAgent | 2 | | Status | Running | | Message | Benchmark task is running | | CreateTime | 2021-10-20 12:38:35 | | UpdateTime | 2021-10-20 12:38:45 | | Config | { | | | "base": { | | | "agentCount": 2, | | | "concurrency": 40, | | | "duration": 1200, | | | "requestCount": | | | 922337203685477****, | | | }, | | | ... | | | } | +----------------+------------------------------------------------------------------------------+
Enable real-time visualization for a stress testing task
Description
You can run the
bench visualizecommand to enable real-time visualization for a stress testing task. This command allows you to access a web page that displays the real-time monitoring data of the stress testing task through 127.0.0.1 by using the web browser of your on-premises computer.Syntax
<eascmd64> bench visualize <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench visualize benchmark-xgb-test-b514The system returns information similar to the following output:
[OK] Click the link http://127.0.0.1:18734/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-xgb-test-b514Use your browser to visit
http://127.0.0.1:18734/eas-benchmark/statsviewto view the real-time monitoring data.
Stop a stress testing task
Description
You can run the
bench stopcommand to stop a running stress testing task.Syntax
<eascmd64> bench stop <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench stop benchmark-xgb-test-b514The system returns information similar to the following output:
Are you sure to stop the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Task [benchmark-xgb-test-b514] is stopping [OK] [Agnet: 0/1]: Benchmark task is Running [OK] [Agnet: 0/1]: Benchmark task is Stopped [OK] Benchmark task is stopped
Obtain the report of a stress testing task.
Description
You can run the
bench reportcommand to obtain the report of a stress testing task.NoteIf the stress testing task enters the Stopped state, the task is complete and the task report is stored in OSS.
Syntax
<eascmd64> bench report <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench report benchmark-xgb-test-b514The system returns information similar to the following output:
[OK] Benchmark task benchmark-demo-test-c7eb report url: http://eas-benchmark.oss-cn-chengdu.aliyuncs.com/summary/benchmark-demo-test-c7eb-10004.htmlEnter the URL displayed in the output into the address bar of your browser to view the task report.
Start a stress testing task
Description
You can run the
bench startcommand to start a stopped stress testing task.Syntax
<eascmd64> bench start <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench start benchmark-xgb-test-b514The system returns information similar to the following output:
Are you sure to start the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Task [benchmark-xgb-test-b514] is starting [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 1/1]: Benchmark task is Running [OK] Benchmark task is Running [OK] Click the link http://127.0.0.1:18947/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-xgb-test-b514
Dynamically modify the number of agent workers and concurrency
Description
If you set the stress testing mode to manual, you can run the
bench updatecommand to dynamically modify the number of agent workers and concurrency.Syntax
<eascmd64> bench update <benchmark_task_name> -Doptional.concurrency=<attr_value> -Doptional.agentCount=<attr_value>Parameters
benchmark_task_name: the name of the stress testing task.
<attr_value>: the actual value.
Example
<eascmd64> bench update benchmark-demo-b99c -Doptional.concurrency=2 -Doptional.agentCount=1The system returns information similar to the following output:
[RequestId]: 9920C672-4D41-5CC4-8EC0-C690F76E**** [OK] Running [TaskName: benchmark-demo-b99c, DesiredAgent:1, AvailableAgent: 1, Message: Benchmark task is Updating] [OK] Benchmark task benchmark-demo-b99c was updated successfully
Delete a stress testing task
Description
You can run the
bench deletecommand to delete a stress testing task. After the task is deleted, the task report stored in OSS is also deleted.Syntax
<eascmd64> bench delete <benchmark_task_name>Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench delete benchmark-xgb-test-b514The system returns information similar to the following output:
Are you sure to delete the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Benchmark task benchmark-xgb-test-b514 is Deleting [OK] Benchmark task was deleted successfully
Delete or restart one or more instances
Description
You can run the
deleteworkersordwcommand to delete one or more instances for a service. After one or more instances are deleted, the system automatically starts new instances to reach the specified number of allocated instances. Therefore, you can also run this command to restart instances.Syntax
<eascmd64> dw <service_name> <instance_names>Parameters
<service_name>: the name of the service.
<instance_names>: the name of the instance that you want to delete. You can specify multiple instance names. Separate multiple instance names with commas (,).
Example
<eascmd64> dw mnist_saved_model_example mnist-saved-model-example-69cf5dd6c7-5****The system returns information similar to the following output:
Are you sure to delete the instances [mnist-saved-model-example-69cf5dd6c7-5****] of service [mnist_saved_model_example] in [cn-shenzhen]? [Y/n]Press the Y key. The system returns information similar to the following output:
[RequestId]: 564C8F56-D97A-555E-9E0B-22BE140A**** [OK] Instance(s) [mnist-saved-model-example-69cf5dd6c7-5****] for service [mnist_saved_model_example] in region [cn-shenzhen] was deleted successfully
Initialize the Python SDK environment
This operation is supported only in the Linux operating system.
Description
You can run
pysdk initcommand to initialize the Python SDK environment.Syntax
<eascmd64> pysdk init ./pysdk_demoParameters
N/A
Example
Run the following command to perform an initialization operation:
<eascmd64> pysdk init ./pysdk_demoThe system returns information similar to the following output:
[PYSDK] Please choose your python version [enter for 3.6]:Enter 3.6. The system displays information similar to the following output:
Collecting package metadata (current_repodata.json): done Solving environment: done ... [PYSDK] Installing python processor example app.py [PYSDK] Installing python service example app.json
Compress the complete environment and code
This operation is supported only in the Linux operating system.
Description
You can run the
pysdk packcommand to compress the complete environment and code.Syntax
<eascmd64> pysdk pack ./<demo>Parameters
<demo>: the directory that stores the environment or code.
Example (In this example, the directory that stores the environment or code is demo.)
<eascmd64> pysdk pack ./demoThe system returns information similar to the following output:
[PYSDK] Creating package: /mnt/workspace/demo.tar.gz
View resource groups
Description
You can run the
resource listorresource lscommand to view the resource groups within the current account.Syntax
<eascmd64> resource lsParameters
N/A
Example
<eascmd64> resource lsThe system returns information similar to the following output:
+--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+ | RESOURCENAME | CLUSTERID | INSTANCECOUNT | GPUCOUNT | CPUCOUNT | OWNERUID | CREATETIME | STATUS | +--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+ | eas-r-lzo32vrdbtukr7te3i | cn-shanghai | 1 | 0 | 16 | 182848887922**** | 2020-03-18 13:09:24 | ResourceReady | +--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+
View the details of a resource group
Description
You can run the
resource desccommand to view the details of a resource group.Syntax
<eascmd64> resource desc <resource_id>Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource listor resource ls command.Example
View the details of a resource group whose ID is eas-r-lzo32vrdbtukr7te3i.
<eascmd64> -c ~/.eas/shanghai2.conf resource desc eas-r-lzo32vrdbtukr7te3iThe -c ~/.eas/shanghai2.conf part indicates that a custom configuration file is used instead of the default configuration file ~/.eas/config. The system returns information similar to the following output:
+---------+-----------------+----------------------------------------------------------+ | Basic | ResourceName | eas-r-lzo32vrdbtukr7te3i | | | Region | cn-shanghai | | | CpuCount | 16 | | | GpuCount | 0 | | | instanceCount | 1 | | | CreateTime | 2020-03-18 13:09:24 | | | LastStatus | ResourceReady | | | Message | Resource is ready | | | RoleArn | acs:ram::xxx:role/AliyunPAIAccessingENIRole | | Network | VpcId | vpc-uf6s9pv47nu03srne**** | | | VSwitchId | vsw-uf6voq53e893k56ws**** | | | SecurityGroupId | sg-uf6c5twkfar8l06c**** | | | DestinationCIDR | | | | AuxVSwitchList | [] | +---------+-----------------+----------------------------------------------------------+
View the instances in a resource group
Description
You can run the
resource list_instanceorresource licommand to view the instances in a resource group and the resource usage of each instance.Syntax
<eascmd64> resource list_instance <resource_id>Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource listor resource ls command.Example
<eascmd64> resource li eas-r-lzo32vrdbtukr7te3iThe system returns information similar to the following output:
+------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+ | INSTANCENAME | INSTANCEIP | STATUS | TOTAL/USED CPU | TOTAL/USED GPU | TOTAL/USED MEMORY | CREATETIME | INSTANCETYPE | CHARGETYPE | +------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+ | cn-shanghai.i-uf6dj71ir6mh3gjmaz3a | 10.224.XX.XX | Ready | 16/6 | 0/0 | 62240M/4200M | 2020-03-18 13:09:34 | ecs.g6.4xlarge | PostPaid | +------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+
Enable direct connection for a resource group
Description
You can use the
resource networkcommand to add a resource group to your VPC. This lets you call the EAS service directly from your VPC using software-based load balancing. A EAS Processor can also access internal network resources, such as RDS and Redis, in your VPC.Syntax
<eascmd64> resource network <resource_id> -s <network_cfg.json>Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource listor resource ls command.<network_cfg.json>: the network configuration file. The following information shows the format of the file:
{ "Action":"create", "VSwitchId": "vsw-8vbsunr5bkcbyxh94****", "SecurityGroupId": "sg-8vbhwowdxzx5fjcx****", "VSwitchIdList": ["vsw-8xbsunr5abcbyqh93****", "vsw-8xbs1y7gu6cxbvqzw****"], "DestinationCIDR": "192.XX.XX.XX/16" }The following table describes the parameters in the file.
Parameter
Description
Required
Default value
Action
Specifies whether to enable direct connection for the resource group. Valid values:
create: Enables the VPC configuration.
delete: Disables the VPC configuration. No other parameters are required.
Yes
N/A
VSwitchId
The ID of the primary vSwitch to add. EAS automatically creates an elastic network interface (ENI) in the vSwitch. Do not delete the ENI. Otherwise, connections may fail.
Yes
N/A
SecurityGroupId
The ID of the security group to which the Elastic Compute Service (ECS) instances where the clients are deployed belong.
NoteThe ECS instances must belong to this security group. Otherwise, connections may fail.
Yes
N/A
VSwitchIdList
A list of secondary vSwitches to add. They must be in the same VPC as the primary vSwitch. The IP address ranges of these vSwitches are automatically added to the EAS route table.
No
Empty array ([])
DestinationCIDR
The destination CIDR block of the client to add. It must be in the same VPC as the primary vSwitch. This CIDR block is automatically added to the EAS route table.
No
Empty string ("")
NoteVSwitchIdList and DestinationCIDR serve the same purpose: to connect the EAS cluster to your network segment. You can use VSwitchIdList to connect to multiple vSwitches. You can use the DestinationCIDR field to connect to a large network segment, such as an entire VPC. Do not use the 10.0.0.0/8, 10.224.0.0/16, or 10.240.0.0/16 network segments. Otherwise, network conflicts will occur. If you have other requirements, contact your business manager for assistance.
References
You can use the HTTP URL that is generated when you create a service to call the prediction service. The input and output formats of the prediction service are defined by the processor that you use. For more information, see topics in the Construct requests for services based on a universal processor chapter.
For more information about how to create and manage services in the console, see Custom deployment.