Asaf
Asaf

Reputation: 8216

Getting InvalidInput error on changeResourceRecordSets

I'm trying to create a record set for a Hosted Zone:

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);
});

I keep getting the error: InvalidInput: Invalid request

Upvotes: 1

Views: 313

Answers (1)

Asaf
Asaf

Reputation: 8216

I've found out that the TTL attribute was missing, after adding that it worked just fine, complete example:

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);
});

Upvotes: 3

Related Questions