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