问题描述
我们在AWS一个VPC,它有由AWS提供了一些功能来自动专用DNS添加到route53时手动启动一个实例。
We have a vpc in aws, it there some feature provided by aws to automatically add private DNS to route53 when manually launch an instance.
推荐答案
如果您已经安装博托,您可以添加/更新DNS设置:
If you have installed boto, you can add / update DNS settings like this:
DNS_ADDRESS="`ec2metadata | grep 'public-hostname:' | cut -d ' ' -f 2`"
/usr/local/bin/route53 change_record <Hosted zone ID> foo.bar.com. CNAME $DNS_ADDRESS 300
DNS_ADDRESS
是实例的AWS DNS名称,如 ec2-1-2-3-4.eu-西1.compute.amazonaws。 COM 的
DNS_ADDRESS
is the AWS DNS name of the instance such as ec2-1-2-3-4.eu-west-1.compute.amazonaws.com
第二行创建了5分钟TTL一个CNAME。您需要添加要更改域的托管区域ID。
The second line creates a CNAME with 5min TTL. You need to add the hosted zone ID of the domain you want to change.
如果你把这个片段到的/etc/rc.local
,该实例会自动更新/创建CNAME时,它的启动。
If you put this snippet into /etc/rc.local
, the instance will automatically update / create the CNAME when it's booting.
我不知道你有私DNS的意思。 Route53提供了一个(公共)DNS服务。但是,如果你的情况是VPC里面有没有危害,使DNS条目公众,因为没有人可以反正访问它们。
I'm not sure what you mean with "private" DNS. Route53 provides a (public) DNS service. However, if your instances are inside a VPC there's no harm to make the DNS entries public, since no one can access them anyway.
这篇关于有没有提供的功能的AWS私有DNS自动添加到route53的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!