Skip to content

[Custom Domains][M2] Support creating Route53 IpV4 records #1128

@praneetap

Description

@praneetap

Related Issues

#783

Description

Milestone 2 targets adding Route53 support to Custom Domains feature. This task is to track adding Route 53 type A records to a provided HostedZone. If using EDGE, the AWS::CloudFront::Distribution resource must be defined in the same template.
SAM input -

  Type: AWS::Serverless::Api
  Properties:
    Domain:
      DomainName: example.com
      Certificate: !Ref MyCertificate 
      EndpointConfiguration: REGIONAL | EDGE 
      Route53:
        EvaluateTargetHealth: true #false by default, must be false for EDGE
        HostedZoneId: xyz # required

Resource changes - Must create AWS::Route53::RecordSetGroup
REGIONAL -

  APIDomainName:
    Type: 'AWS::ApiGateway::DomainName'
    Properties:
      EndpointConfiguration:
        Types: [REGIONAL] 
      RegionalCertificateArn: !Ref Certificate
      DomainName: !Ref DomainName

  DomainNameTypeARoute53RecordSet:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      HostedZoneId: !Ref HostedZoneId
      RecordSets:
        - Name: !Ref DomainName
          Type: A
          AliasTarget:
            DNSName: !GetAtt APIDomainName.RegionalDomainName
            HostedZoneId: !GetAtt APIDomainName.RegionalHostedZoneId

EDGE -

  APIDomainName:
    Type: 'AWS::ApiGateway::DomainName'
    Properties:
      EndpointConfiguration:
        Types: [EDGE]
      CertificateArn: !Ref CertificateARN
      DomainName: !Ref DomainName
  DomainNameTypeARoute53RecordSet:
    Type: AWS::Route53::RecordSetGroup
    Properties:
      HostedZoneId: !Ref HostedZoneId
      RecordSets:
      - Name: !Ref DomainName
        Type: A
        AliasTarget:
          HostedZoneId: Z2FDTNDATAQYW2 # (const value for cloudfront distributions)
          DNSName: !GetAtt Distribution.DomainName

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions