我正在尝试CNAME
使用ALIAS
ruby aws-sdk
gem 的设置以编程方式创建Route 53 记录.
我在文档中找不到这样做的方法.我看到如何创建一个记录本身但不是如何创建一个ALIAS记录.
rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets rrset = rrsets.create('foo.example.com.', 'CNAME', :ttl => 300, :resource_records => [{:value => 'foo.example.com.s3.amazon.weast.uk'}])
imperalix.. 5
下面是如何在US-WEST-2中为S3 Web站点端点设置别名的示例.
$irb irb> require 'aws-sdk' irb> rrsets = AWS::Route53::HostedZone.new('Z1234').rrsets #replace Z123 with your hosted zone in which you are creating the record. irb> rrset = rrsets.create('foo.example.com.', 'A', :alias_target => {:hosted_zone_id => 'Z3BJ6K6RIION7M', :dns_name => 's3-website-us-west-2.amazonaws.com' , :evaluate_target_health => false }) # Z3BJ6K6RIION7M is the target hosted zone, in this case Z3BJ6K6RIION7M and can be obtained from the below link, if it's s3.
端点和托管区域ID:http: //docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
注意:别名记录不能包含TTL,并且需要目标托管区域ID.他们没有TTL的原因是他们使用目标的TTL.