使用无服务器框架将 Route 53 中的 DNS 记录添加和更新到 Cloudfront

Add and Update DNS Records in Route 53 to Cloudfront with Serverless Framework

我目前正在努力扩展 this repo. It contains source code to deploy a sapper/svelte webapp with the Serverless Framework to AWS. I'm thinking about how to expand the serverless.yml to include Route53 DNS routing to Cloudfront, but I can't seem to wrap my head around it. The serverless-domain-manager 插件似乎是为 Route53 设计的 API 网关路由,但我只使用 Cloudfront、S3 存储桶和 Lambda 部署我的应用程序@Edge 处理程序服务器端呈现应用程序。

我做过类似的事情here

我已经为相关部分修剪了 serverless.yml

WebAppCloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    DependsOn:
      - WebAppS3Bucket
    Properties:
    DistributionConfig:
        ### content trimmed
        Aliases:
          - 'www.example.com'
        ### content trimmed
        ViewerCertificate:
          AcmCertificateArn: 'CertificateArn' # in the linked repo I'm using a plugin to auto generate the certificate
          SslSupportMethod: sni-only
WebsiteDNSName:
    Type: AWS::Route53::RecordSetGroup
    Properties:
    HostedZoneId: 'HostedZoneId' # Taken from the AWS Console
    RecordSets:
      - Name: 'www.example.com'
        Type: A
        AliasTarget:
            HostedZoneId: Z2FDTNDATAQYW2
            DNSName: !GetAtt [WebAppCloudFrontDistribution, DomainName]
            EvaluateTargetHealth: false