如何在 route53 hostedZone 中创建记录

How to create record in route53 hostedZone

我已经创建了 CloudFront 分配并尝试将该记录附加到 route53 托管区域。 当我尝试时出现以下错误。

An error occurred: myDNSRecord - Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=CREATE, Name=abc.yz.com., Type=A, SetIdentifier=null] (Service: AmazonRoute53; Status Code: 400; Error Code: InvalidInput; Request ID: 81fd7f48-3ffb-4fa1-b1ba-cef599834a07; Proxy: null)

myDNSRecord:
      Type: AWS::Route53::RecordSetGroup
      DependsOn:
        - cloudFrontDist
      Properties:
        HostedZoneId: !Ref 53HostedZoneId
        RecordSets:
          - Name: abc.yz.com
            Type: A
            TTL: 300
            AliasTarget:
              HostedZoneId: Z2FDTNDATAQYW2
              DNSName:
                Fn::GetAtt: [cloudFrontDist, DomainName]

我想在 route53

中托管 CloudFront 分配 URL

别名记录不使用 TTL。所以从你的模板中删除它:

myDNSRecord:
      Type: AWS::Route53::RecordSetGroup
      DependsOn:
        - cloudFrontDist
      Properties:
        HostedZoneId: !Ref 53HostedZoneId
        RecordSets:
          - Name: abc.yz.com
            Type: A
            AliasTarget:
              HostedZoneId: Z2FDTNDATAQYW2
              DNSName:
                Fn::GetAtt: [cloudFrontDist, DomainName]