gpt4 book ai didi

ruby - 使用 ruby​​ sdk 在 Route 53 上创建 ALIAS 记录

转载 作者:数据小太阳 更新时间:2023-10-29 08:32:02 24 4
gpt4 key购买 nike

我正在尝试使用 ALIAS 设置和 ruby​​ aws-sdk gem 以编程方式创建 Route 53 CNAME 记录。

我在文档中找不到执行此操作的方法。我知道如何创建记录本身,但不知道如何创建 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'}])

最佳答案

下面是一个示例,说明如何在 US-WEST-2 中别名到 S3 网站端点。

$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。

关于ruby - 使用 ruby​​ sdk 在 Route 53 上创建 ALIAS 记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23613905/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com