aliyun-cli安裝和使用

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

鏡像規格

https://www.alibabacloud.com/help/zh/doc-detail/100410.htm?spm=a2c63.p38356.b99.172.62616336yh6HZ0#title-hhk-ku6-rtm

在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

創建vpc

https://help.aliyun.com/document_detail/35737.html

https://developer.aliyun.com/ask/144910?spm=a2c6h.13524658

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章