[英]How to create a dynamic amount of sub domain with Route53 in Cloudformation?
I need to create a dynamic number of subdomains depending on how many instances I want to create. 我需要根据要创建的实例数量创建动态数量的子域。 my goal id to create something like
我的目标编号以创建类似
customer-code-100.example.com 客户代码100.example.com
customer-code-101.example.com 客户代码101.example.com
customer-code-102.example.com customer-code-102.example.com
customer-code-103.example.com 客户代码103.example.com
I've researched, but there doesn't seem to be a solution. 我已经研究过,但似乎没有解决方案。 I need to be able to run Puppet on multiple hosts, but they each need a different domain.
我需要能够在多个主机上运行Puppet,但是它们每个都需要一个不同的域。
Ideally, I want to be able to use autoscaling or some sort of dynamic way to accomplish this, but I haven't been able to find any answers. 理想情况下,我希望能够使用自动缩放或某种动态方式来完成此任务,但我一直找不到任何答案。
MyRecordSet:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneName: example.com.
Name: !Join[".", [!Ref Alias, "example.com"]]
Type: A
The easier method is to have the instances register themselves with Amazon Route 53 . 比较简单的方法是让实例在Amazon Route 53中进行注册 。 This can be done with a startup script that uses the AWS CLI to register a domain name.
这可以通过使用AWS CLI注册域名的启动脚本来完成。
Admittedly, it can be hard to decide which number to assign an instance, especially if Auto Scaling is being used. 诚然,很难确定要分配实例的编号,尤其是在使用Auto Scaling的情况下。 For example:
例如:
Instance 1
and Instance 2
exist, obviously the next is Instance 3
Instance 1
和Instance 2
存在,则下一个显然是Instance 3
Instance 2
is terminated by Auto Scaling and only Instance 1
and Instance 3
exist, should the next instance be Instance 2
or Instance 4
? Instance 2
通过Auto Scaling终止并且仅Instance 1
和Instance 3
存在,那么下一个实例应该是Instance 2
还是Instance 4
? Or, use part of the Instance ID to generate the name. 或者,使用实例ID的一部分来生成名称。
Then there is the problem of "unregistering" a subdomain when the instance is terminated. 然后,存在实例终止时“注销”子域的问题。
Actually, there should normally be no need to assign a subdomain to an Auto Scaling instance . 实际上, 通常无需为Auto Scaling实例分配子域 。 This is because traffic is normally routed through a Load Balancer, or the instances are pulling work from a queue.
这是因为流量通常通过负载均衡器进行路由,或者实例正在从队列中拉动工作。 There should be no need to uniquely address a specific instance.
无需唯一地解决特定实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.