Skip to content

Instantly share code, notes, and snippets.

@titogeorge
Created April 24, 2018 15:02
Show Gist options
  • Save titogeorge/eb54df05dfaa7a69f0a0515ca31d3aea to your computer and use it in GitHub Desktop.
Save titogeorge/eb54df05dfaa7a69f0a0515ca31d3aea to your computer and use it in GitHub Desktop.
AWS Cloudformation: Custom API Gateway Domain Name
APIRecordSet:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref hosted-zone-id
Comment: CNAME Redirect to the API Gateway
Name: !Join
- ""
- [ my-api. , !Ref hosted-zone-name, '.']
Type: CNAME
TTL: '300'
ResourceRecords:
- !GetAtt ApiGwCustomDomainName.DistributionDomainName
ApiGwCustomDomainName:
Type: AWS::ApiGateway::DomainName
Properties:
DomainName: !Join [ . , [ my-api, !Ref hosted-zone-name ]]
CertificateArn: !Ref certificateArn
ApiBasePathMapping:
Type: 'AWS::ApiGateway::BasePathMapping'
Properties:
DomainName: !Ref ApiGwCustomDomainName
RestApiId: !Ref MyApiGateway
Stage: uat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment