aliyun-cli
官方文档
https://github.com/aliyun/aliyun-cli
https://help.aliyun.com/knowledge_detail/139508.html
centos安装aliyun-cli
curl -LO https://github.com/aliyun/aliyun-cli/releases/download/v3.0.42/aliyun-cli-linux-3.0.42-amd64.tgz
tar -zxvf aliyun-cli-linux-3.0.42-amd64.tgz -C /usr/local/bin/
配置凭证,登录阿里云,点击头像选择accesskey管理,创建并获取key和secret即可。
aliyun configure set \
--profile akProfile \
--mode AK \
--region cn-qingdao \
--access-key-id AccessKeyId \
--access-key-secret AccessKeySecret
向ecs实例发送shell命令进行测试:
aliyun ecs RunCommand --InstanceId.1 i-m5e3gpxv4kgzm2ne37e4 --RegionId cn-qingdao --Type RunShellScript --CommandContent "echo hello"
查询实例信息
实例规格
https://www.alibabacloud.com/help/zh/doc-detail/59977.htm?spm=a2c63.p38356.b99.72.63b5735bldPzKl
镜像规格
在cloudshell中查询region ID
登录cloudshell:https://shell.aliyun.com/
#列出所有region信息
aliyun ecs DescribeRegions --output cols=RegionId,RegionEndpoint,LocalName rows=Regions.Region
#列出region下的Zone信息
aliyun ecs DescribeZones --RegionId cn-hongkong --output cols=ZoneId,LocalName rows=Zones.Zone
#列出实例类型信息
aliyun ecs DescribeInstanceTypes | jq