Reputation: 4682
I see that I need to use the change_resource_record_sets method. But what parameters do I provide? Anyone has an example?
route53.change_resource_record_sets(
{
hosted_zone_id: "/hostedzone/EXAMPLEID",
change_batch: {
changes: [
{
action: "DELETE",
resource_record_set: {
name: "r9i.staging.example.com.",
type: "CNAME",
resource_records: [
{ value: "other.example.io" }
],
alias_target: nil
}
}
]
}
})
Returns:
Aws::Route53::Errors::InvalidInput: Invalid request
from /Users/amir/.rvm/gems/ruby-2.2.1/gems/aws-sdk-core-
2.2.3/lib/seahorse/client/plugins/raise_response_errors.rb:15:in
`call'
from /Users/amir/.rvm/gems/ruby-2.2.1/gems/aws-sdk-core-
2.2.3/lib/aws-sdk-core/plugins/param_converter.rb:20:in `call'
from /Users/amir/.rvm/gems/ruby-2.2.1/gems/aws-sdk-core-
2.2.3/lib/seahorse/client/plugins/response_target.rb:21:in `call'
from /Users/amir/.rvm/gems/ruby-2.2.1/gems/aws-sdk-core-
2.2.3/lib/seahorse/client/request.rb:70:in send_request'
from /Users/amir/.rvm/gems/ruby-2.2.1/gems/aws-sdk-core-
2.2.3/lib/seahorse/client/base.rb:207:in
block (2 levels) in
define_operation_methods'
from (irb):62
Upvotes: 1
Views: 777
Reputation: 3751
Looks like are are missing the TTL. Below worked for me. Replace the TTL value with the value of your record.
require 'aws-sdk'
r53 = Aws::Route53::Client.new(region:'us-east-1')
r53.change_resource_record_sets(
{
hosted_zone_id: "/hostedzone/ZZZZZ",
change_batch: {
changes: [
{
action: "DELETE",
resource_record_set: {
name: "r9i.staging.example.com.",
type: "CNAME",
ttl: 300,
resource_records: [
{ value: "other.example.io" }
],
alias_target: nil
}
}
]
}
})
Upvotes: 2