I'm trying to create a multi-region serverless application on AWS. I've followed the instructions given here. I'm using the Serverless framework, which uses Cloudformation scripts for creating all the resources on AWS.
I want to create a custom domain for API gateway as a Regional Endpoint. When it creates a Regional endpoint, it generates a target domain. I would like to know how can I get the value of the target domain in my Cloudformation script?
When I create an Edge optimized Endpoint, I get the value of the CloudFront deployment by using the DistributionDomainName attribute. But I don't see any attribute for the target domain name when a Regional Endpoint is created. I tried using the DistributionDomainName attribute for a Regional endpoint, but it throws an error which says that there is no DistributionDomainName.
Below is a part of my script -
# Creates a custom domain for the ApiGateway
customDomain:
Type: 'AWS::ApiGateway::DomainName'
Properties:
DomainName: ${self:custom.domain}
EndpointConfiguration:
Types:
- REGIONAL
RegionalCertificateArn: ${self:custom.certificateArn}
# Insert a DNS record in route53 hosted zone to redirect from the custom domain to CF distribution
dnsRecord:
Type: AWS::Route53::RecordSet
Properties:
Region: ${self:provider.region}
SetIdentifier: ${self:provider.region}
HostedZoneId: ${self:custom.hostedZoneId}
Name: ${self:custom.domain}
Type: CNAME
TTL: 60
ResourceRecords:
- "Fn::GetAtt": [customDomain, DistributionDomainName]