While attempting to add an A record to my hosted zone, I kept getting this error (using the node.js SDK).
InvalidInput: Invalid request
at Request.extractError (C:\Projects\automation\node_modules\aws-sdk\lib\protocol\rest_xml.js:44:29)
at Request.callListeners (C:\Projects\automation\node_modules\aws-sdk\lib\sequential_executor.js:105:20)
at Request.emit (C:\Projects\automation\node_modules\aws-sdk\lib\sequential_executor.js:77:10)
at Request.emit (C:\Projects\automation\node_modules\aws-sdk\lib\request.js:595:14)
at Request.transition (C:\Projects\automation\node_modules\aws-sdk\lib\request.js:21:10)
at AcceptorStateMachine.runTo (C:\Projects\automation\node_modules\aws-sdk\lib\state_machine.js:14:12)
at C:\Projects\automation\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (C:\Projects\automation\node_modules\aws-sdk\lib\request.js:37:9)
at Request.<anonymous> (C:\Projects\automation\node_modules\aws-sdk\lib\request.js:597:12)
at Request.callListeners (C:\Projects\automation\node_modules\aws-sdk\lib\sequential_executor.js:115:18)
Here was a snippet of my code:
var change = {
Action: "UPSERT",
ResourceRecordSet: {
Name: "test.developmentshack.com",
Type: "A",
ResourceRecords: [ { Value: ipAddress }]
}
};
route53.changeResourceRecordSets({
HostedZoneId: zone.Id,
ChangeBatch: {
Changes: [ change ]
}
}, function (error, data) {
if (error) { throw error; }
console.log('Pointed ' + fullDomain + ' to ' + ipAddress);
});
It turns out that the TTL is required when modifying an A record.
var change = {
Action: "UPSERT",
ResourceRecordSet: {
Name: "test.developmentshack.com",
Type: "A",
TTL: 600,
ResourceRecords: [ { Value: ipAddress }]
}
};
route53.changeResourceRecordSets({
HostedZoneId: zone.Id,
ChangeBatch: {
Changes: [ change ]
}
}, function (error, data) {
if (error) { throw error; }
console.log('Pointed ' + fullDomain + ' to ' + ipAddress);
});