Cloudformation: Requested attribute DistributionHostedZoneId does not exist in schema for AWS::CloudFront::Distribution

0

Hollo Please i get this error when i want to get my Cloudfront Distribution Hosted Zone ID

Error

Requested attribute DistributionHostedZoneId does not exist in schema for AWS::CloudFront::Distribution

My CloudFormation Template

  FESCloudFrontDistributionDomainNameRecord:
    Type: AWS::Route53::RecordSet # Defines a Route 53 record set
    Properties:
      # HostedZoneName: !Sub "${CustomDomainName}."
      HostedZoneId: !Ref CustomDomainHostedZoneID
      Name: !Sub "${CustomDomainName}." # Specifies the record name
      Type: A # Specifies the record type as A
      AliasTarget:
        HostedZoneId: !GetAtt FECloudFrontDistribution.DistributionHostedZoneId
        DNSName: !GetAtt FECloudFrontDistribution.DomainName 

Thanks

1개 답변
1
수락된 답변

Hello.
Try changing "HostedZoneId" to "Z2FDTNDATAQYW2" as described in the following document.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-route53.html#w4ab1c23c21c84c11

When you create alias resource record sets, you must specify Z2FDTNDATAQYW2 for the HostedZoneId property, as shown in the following example. Alias resource record sets for CloudFront can't be created in a private zone.

Your template would look something like this

  FESCloudFrontDistributionDomainNameRecord:
    Type: AWS::Route53::RecordSet # Defines a Route 53 record set
    Properties:
      # HostedZoneName: !Sub "${CustomDomainName}."
      HostedZoneId: !Ref CustomDomainHostedZoneID
      Name: !Sub "${CustomDomainName}." # Specifies the record name
      Type: A # Specifies the record type as A
      AliasTarget:
        HostedZoneId: Z2FDTNDATAQYW2
        DNSName: !GetAtt FECloudFrontDistribution.DomainName 
profile picture
전문가
답변함 9달 전
profile picture
전문가
검토됨 9달 전
profile pictureAWS
전문가
검토됨 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠