koocli
华为云KooCLI是一个云管理命令行工具,它提供了一种简单、一致的方式来管理华为云资源。通过KooCLI,用户可以使用统一的命令和操作来管理应用和配置,从而提高云环境的运维效率。
自动应答安装
安装
| curl -sSL https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
|
初始化并运行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 | [root@testcce-26771 ~]# hcloud configure init
This will delete all configuration information. Continue? (y/N): y
Starting initialization. 'Secret Access Key' is anonymized. To obtain the parameter, see 'https://support.huaweicloud.com/intl/en-us/usermanual-hcli/hcli_09.html'.
Access Key ID [required]: SNVJ1HU1TQ0DB3RG1PHJ
Secret Access Key [required]: ****
Secret Access Key (again): ****
Region: la-north-2
********************************************************
***** *****
***** Initialization successful *****
***** *****
********************************************************
[root@testcce-26771 ~]# hcloud ECS NovaListServers
{
"servers": [
{
"name": "testcce-26771",
"links": [
{
"rel": "self",
"href": "https://ecs.la-north-2.myhuaweicloud.com/v2.1/0e0e5cabfa80f2892f17c00390299e63/servers/8d0c9e65-1fc8-45ea-bdc7-9c42467f760b"
},
{
"rel": "bookmark",
"href": "https://ecs.la-north-2.myhuaweicloud.com/0e0e5cabfa80f2892f17c00390299e63/servers/8d0c9e65-1fc8-45ea-bdc7-9c42467f760b"
}
],
"id": "8d0c9e65-1fc8-45ea-bdc7-9c42467f760b"
}
]
}
|
自定义 Koocli 输出格式 ,可以输出为表格格式,同进也可以通过json过滤输出某些想要的内容。
通过docker方式安装运行
编写dockerfile
| FROM ubuntu:latest
RUN apt-get update -y && apt-get install curl -y
# Install KooCLI with one click.
RUN curl -sSL https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
WORKDIR hcloud
ENTRYPOINT ["/usr/local/bin/hcloud"]
|
build镜像并运行
| docker build --no-cache -t hcloudcli .
docker run -it -d --name hcloudcli hcloudcli
docker run --rm -it hcloudcli ${command}
docker run --rm -it -v /root/.hcloud/:/root/.hcloud/ hcloudcli ${command}
alias hcloud='docker run --rm -it hcloudcli'
|
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))