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

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