[使用aws-cli在命令行中创建Route53记录

问题描述 投票:0回答:1

如何从命令行轻松创建Amazon AWS Route53?在网络控制台中单击所需的时间太长。

amazon-web-services command-line aws-cli amazon-route53
1个回答
0
投票

您需要知道托管区域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"
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.