[英]Use Route53 template in cloudformation with Cloudfront
"DNS": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
"HostedZoneId" : "Z058101PST6709",
"RecordSets" : [{
"Name" : {
"Ref": "AlternateDomainNames"
},
"Type" : "CNAME",
"TTL" : "900",
"ResourceRecords" : {
"Ref": "myDistribution"
},
"Weight" : "140"
}]
}
}
Hi Team, I am going to create a route53 record with cloudfront please find the cloud-formation code and in which I am getting an error while create a stack.嗨团队,我将使用 cloudfront 创建一个 route53 记录,请找到云形成代码,我在创建堆栈时遇到错误。 Basically I want to create a CNAME record by using cloudfront domain name.
基本上我想通过使用云端域名创建一个 CNAME 记录。 Please help me out in this.
请帮我解决这个问题。
You can use the below template您可以使用以下模板
"DNS": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
"HostedZoneId": "Z058101PST6709",
"Name": {
"Ref": "AlternateDomainNames"
},
"ResourceRecords": [{ "Fn::GetAtt": ["myDistribution", "DomainName"] }],
"TTL": "900",
"Type": "CNAME"
}
}
I should raise as you're using Route 53 you should take advantage of using Alias records instead of CNAME
records for your CloudFront Distribution.我应该提出,当您使用 Route 53 时,您应该利用别名记录而不是
CNAME
记录来进行 CloudFront 分配。
This could be done via the below.这可以通过以下方式完成。
{
"Type": "AWS::Route53::RecordSetGroup",
"Properties": {
"HostedZoneId": "Z058101PST6709",
"RecordSets": [{
"Name": {
"Ref": "AlternateDomainNames"
},
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z2FDTNDATAQYW2",
"DNSName": { "Fn::GetAtt": ["myDistribution", "DomainName"] }
}
}]
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.