阿里云CLI管理域名解析

可以管理大部分阿里云服务,这里拿域名来做例子

下载对应平台的cli

wget https://github.com/aliyun/aliyun-cli/releases/download/v3.0.23/aliyun-cli-linux-3.0.23-amd64.tgz
tar xvf aliyun-cli-linux-3.0.23-amd64.tgz
mv aliyun /usr/local/bin/
配置
创建accesskeys子账号,授权管理云解析权限,复制到文本备忘!
aliyun configure
Access Key Id []: 
Access Key Secret []:
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en: en
使用

添加解析记录
aliyun alidns  AddDomainRecord --DomainName 111.com --Type Txt --RR _dns112233 --Line default --Value dns112233 --TTL 600
aliyun alidns  AddDomainRecord --DomainName 111.com --Type A --RR ops --Line default --Value 1.1.1.1 --TTL 600

获取解析记录列表
aliyun alidns  DescribeDomainRecords --DomainName 111.com
aliyun alidns  DescribeDomainRecords --DomainName 111.com --KeyWord www

也可以更美观

aliyun alidns  DescribeDomainRecords --DomainName 111.com  --output cols=RR,Value rows=DomainRecords.Record[]

删除解析记录
aliyun alidns DescribeDomainRecords --DomainName 111.com  --RRKeyWord ops
aliyun alidns DeleteDomainRecord --RecordId  1814xx31487178xxx
aliyun alidns DeleteDomainRecord --RecordId 1814xx73868964xxx

修改解析记录
aliyun alidns AddDomainRecord --DomainName 111.com --Type A --RR ops2 --Line default --Value 1.1.1.1 --TTL 600
aliyun alidns DescribeDomainRecords --DomainName 111.com  --RRKeyWord ops2
aliyun alidns UpdateDomainRecord  --RR ops2  --RecordId 1814xx97325693xxx --Type  A --Value 2.2.2.2

查看所有域名
aliyun alidns  DescribeDomains 
多使用--help,如
 aliyun alidns --help
 aliyun alidns xxx --help

多看官网文档 

https://help.aliyun.com/document_detail/29776.html?spm=a2c4g.11186623.6.639.79886938nuk3iP


阿里云CLI支持多用户配置。您可以使用$ aliyun configure --profile user1命令指定使用哪个账号调用云产品的API。
执行$ aliyun configure list命令可以查看当前的用户配置, 如下表所示。其中在Profile后面有星号(*)标志的为当前使用的默认用户配置。
配置新用户
aliyun configure --profile user1
aliyun alidns  DescribeDomainRecords --DomainName 222.com
切换用户,一路回车
aliyun configure --profile user2
删除用户配置
aliyun configure delete --profile user2
 

转载于:https://my.oschina.net/longquan/blog/3089666

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值