如何从命令行轻松创建Amazon AWS Route53?在网络控制台中单击所需的时间太长。
您需要知道托管区域ID。列出您的托管区域:
$ aws route53 list-hosted-zones
输出应为:
{
"HostedZones": [
{
"Id": "/hostedzone/ZFYKW933LX916",
"Name": "example.com.",
"CallerReference": "C4E8C4F3-5265-4248-B324-807A4AB90ABC",
"Config": {
"PrivateZone": false
},
"ResourceRecordSetCount": 39
},
{
"Id": "/hostedzone/Z6JTNNZOHT191",
"Name": "example.net.",
"CallerReference": "A4001EE9-C0FD-F484-9F8D-688F681EFDEF",
"Config": {
"PrivateZone": false
},
"ResourceRecordSetCount": 16
}
]
}
现在您需要创建一个更改批次:
$ aws --profile messa route53 change-resource-record-sets --hosted-zone-id /hostedzone/ZFYKW933LX916 --change-batch '{"Changes": [ { "Action": "UPSERT", "ResourceRecordSet": { "Name": "foobar.example.com", "Type": "A", "TTL": 3600, "ResourceRecords": [{ "Value": "11.222.33.44" }] } } ]}'
输出应为:
{
"ChangeInfo": {
"Id": "/change/C2T36TTVOVS7KX",
"Status": "PENDING",
"SubmittedAt": "2020-02-12T12:54:43.056Z"
}
}