pip install aliyuncli
pip install aliyun-python-sdk-slb
配置阿里云命令行工具:aliyuncli configure
Aliyun Access Key ID [None]: xxx
Aliyun Access Key Secret [None]: yyy
Default Region Id [None]: cn-hangzhou
Default output format [None]: table
执行向负载均衡添加服务器的命令
aliyuncli slb AddBackendServers --LoadBalancerId 负载均衡ID --BackendServers "[{'ServerId':'服务器ID'}]"
搞定
----------------------------------------------------------------------
| AddBackendServers |
+---------------------------+----------------------------------------+
| LoadBalancerId | RequestId |
+---------------------------+----------------------------------------+
| lb-bp1n61e769zkhq80tbkdw | EA2629C4-8E42-4C00-8617-2A47929B1DFC |
+---------------------------+----------------------------------------+
|| BackendServers ||
|+------------------------------------------------------------------+|
||| BackendServer |||
||+----------------------------------------------+-----------------+||
||| ServerId | Weight |||
||+----------------------------------------------+-----------------+||
||| i-bp1hcjphgf2htolbdsz4 | 100 |||
||| i-bp19ff4vfj48lplby8k9 | 100 |||
||| i-bp1egsobe8vkm1evcclm | 100 |||
||| i-bp18l1h2hdblky3ub164 | 100 |||
||| i-bp1ccq9xttkz6kj77izq | 100 |||
||+----------------------------------------------+-----------------+||
配置 aliyuncli 的自动完成
which aliyun_completer
complete -C '/usr/local/bin/aliyun_completer' aliyuncli
complete