在changeResourceRecordSets上获取InvalidInput错误

时间:2015-07-22 09:28:02

标签: node.js aws-sdk

我正在尝试为托管区创建一个记录集:

var params = {
    ChangeBatch: {
        Changes: [
            {
                Action: 'UPSERT',
                ResourceRecordSet: {
                    Name: 'google5.com', //Domain name
                    Type: 'A',
                    ResourceRecords: [{
                        'Value': '52.255.255.255' //Instance Public IP
                    }]
                }
            }
        ]
    },
    HostedZoneId: '/hostedzone/Z0.....' //Hosted Zone ID
}
route53.changeResourceRecordSets(params, function(err, data) {
    console.log(err);
});

我一直收到错误:InvalidInput: Invalid request

1 个答案:

答案 0 :(得分:2)

我发现TTL属性丢失了,在添加它工作得很好,完整的例子后:

var params = {
    ChangeBatch: {
        Changes: [
            {
                Action: 'UPSERT',
                ResourceRecordSet: {
                    Name: 'google5.com', //Domain name
                    Type: 'A',
                    TTL: 86400, //Critical!
                    ResourceRecords: [{
                        'Value': '52.255.255.255' //Instance Public IP
                    }]
                }
            }
        ]
    },
    HostedZoneId: '/hostedzone/Z0.....' //Hosted Zone ID
}
route53.changeResourceRecordSets(params, function(err, data) {
    console.log(err);
});