如何通过aws cli删除Route53中的DNS记录?

时间:2020-06-04 10:33:14

标签: amazon-web-services dns aws-cli amazon-route53

我正在使用aws cli在Route 53中创建和删除DNS记录。我不确定有效负载或必须使用的命令。根据{{​​3}},我创建了此有效负载,但它无法正常工作。有效载荷是

{
"Comment": "Delete single record set",
"Changes": [
    {
        "Action": "DELETE",
        "ResourceRecordSet": {
            "Name": "$DNS_NAME.",
            "Type": "$RECORD_TYPE",
            "TTL": $TTL,
            "ResourceRecords": [
                {
                    "Value": "${RESOURCE_VALUE}"
                }
            ]                
        }
    }
]

}

我在称为有效负载的变量中处理的

AWS cli命令是

aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_ID} --change-batch payload

知道我在做什么错吗?任何人都可以确认命令和有效载荷是否正确吗?

1 个答案:

答案 0 :(得分:0)

将有效负载保存到json文件中,然后输入文件名。使用file://协议引用有效负载路径。

/* seach haystack for needle, return no. of times needle occurs */
int wordsearch (const char *haystack, const char *needle)
{
    const char *p = haystack;               /* string to search within */
    int found = 0;                          /* no. of matches found */

    /* loop while pointer more than nlen chars from end and 1st char in needle found */
    while ((p = strstr (p, needle))) {      /* loop finding each needle in haystack */
        found += 1;                         /* increment found by 1 */
        p += 1;                             /* increment point to next char */
    }

    return found;   /* return no. of needles in haystack */
}