Paw*_*żak 8 amazon-web-services aws-cloudformation amazon-route53
我想为子域创建一个 Route53 托管区域并NS
记录到父域。
假设我有:
example.com
Run Code Online (Sandbox Code Playgroud)
我想要一个子域的托管区域:
build.example.com
Run Code Online (Sandbox Code Playgroud)
托管区创建工作:
ClusterHostedZone:
Type: "AWS::Route53::HostedZone"
Properties:
Name: !Ref DomainName
HostedZoneConfig:
Comment: Managed by Cloud Formation
HostedZoneTags:
- Key: KubernetesCluster
Value: !Ref KubernetesCluster
Run Code Online (Sandbox Code Playgroud)
委派子域的责任不要:
ParentHostedZoneClusterRecord:
Type: "AWS::Route53::RecordSet"
Properties:
Name: !Ref DomainName
Comment: Managed by Cloud Formation
HostedZoneId: !Ref ParentHostedZoneID
TTL: 30
Type: NS
ResourceRecords: !GetAtt ClusterHostedZone.NameServers
Run Code Online (Sandbox Code Playgroud)
这未实现,我不知道如何获取此信息:
ResourceRecords: !GetAtt ClusterHostedZone.NameServers
Run Code Online (Sandbox Code Playgroud)
Cloud Formation 中是否缺少这个简单的功能?
这对我有用,也许您的模板不起作用,因为您没有指定DependsOn
并且没有按顺序创建资源。
stagingHostedZone:
Type: 'AWS::Route53::HostedZone'
Properties:
HostedZoneConfig:
Comment: Hosted zone for staging environment
Name: staging.example.com
nsRootHostedZoneRecordSet:
Type: 'AWS::Route53::RecordSet'
Properties:
HostedZoneId: Z25*********
Name: staging.example.com.
Type: NS
TTL: '900'
ResourceRecords: !GetAtt stagingHostedZone.NameServers
DependsOn:
stagingHostedZone
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4866 次 |
最近记录: |