亚马逊网络服务-如何使用Ruby SDK从Route53中删除CNAME记录



我发现我需要使用change_resource_record_sets方法。但是我提供了什么参数?有人举个例子吗?

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

退货:

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:在中的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块(2级)中define_operation_methods'来自(irb):62

看起来缺少TTL。下面对我有用。用你的记录值替换TTL值。

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

最新更新