Route53Configuration
Configures the Route53 record sets for an API.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
DistributionDomainName:
String
EvaluateTargetHealth:Boolean
HostedZoneId:String
HostedZoneName:String
IpV6:Boolean
Region:String
SetIdentifier:String
Properties
-
DistributionDomainName
-
Configures a custom distribution of the API custom domain name.
Type: String
Required: No
Default: Use the API Gateway distribution.
AWS CloudFormation compatibility: This property is passed directly to the
DNSName
property of anAWS::Route53::RecordSetGroup AliasTarget
resource.Additional notes: The domain name of a CloudFront distribution.
-
EvaluateTargetHealth
-
When EvaluateTargetHealth is true, an alias record inherits the health of the referenced AWS resource, such as an Elastic Load Balancing load balancer or another record in the hosted zone.
Type: Boolean
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
EvaluateTargetHealth
property of anAWS::Route53::RecordSetGroup AliasTarget
resource.Additional notes: You can't set EvaluateTargetHealth to true when the alias target is a CloudFront distribution.
-
HostedZoneId
-
The ID of the hosted zone that you want to create records in.
Specify either
HostedZoneName
orHostedZoneId
, but not both. If you have multiple hosted zones with the same domain name, you must specify the hosted zone usingHostedZoneId
.Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
HostedZoneId
property of anAWS::Route53::RecordSetGroup RecordSet
resource. -
HostedZoneName
-
The name of the hosted zone that you want to create records in.
Specify either
HostedZoneName
orHostedZoneId
, but not both. If you have multiple hosted zones with the same domain name, you must specify the hosted zone usingHostedZoneId
.Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
HostedZoneName
property of anAWS::Route53::RecordSetGroup RecordSet
resource. -
IpV6
-
When this property is set, AWS SAM creates a
AWS::Route53::RecordSet
resource and sets Type toAAAA
for the provided HostedZone.Type: Boolean
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
Region
-
Latency-based resource record sets only: The Amazon EC2 Region where you created the resource that this resource record set refers to. The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer, and is referred to by an IP address or a DNS domain name, depending on the record type.
When Amazon Route 53 receives a DNS query for a domain name and type for which you have created latency resource record sets, Route 53 selects the latency resource record set that has the lowest latency between the end user and the associated Amazon EC2 Region. Route 53 then returns the value that is associated with the selected resource record set.
Note the following:
-
You can only specify one
ResourceRecord
per latency resource record set. -
You can only create one latency resource record set for each Amazon EC2 Region.
-
You aren't required to create latency resource record sets for all Amazon EC2 Regions. Route 53 will choose the region with the best latency from among the regions that you create latency resource record sets for.
-
You can't create non-latency resource record sets that have the same values for the
Name
andType
elements as latency resource record sets.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Region
property of anAWS::Route53::RecordSetGroup
RecordSet
data type. -
SetIdentifier
-
Resource record sets that have a routing policy other than simple: An identifier that differentiates among multiple resource record sets that have the same combination of name and type, such as multiple weighted resource record sets named acme.example.com that have a type of A. In a group of resource record sets that have the same name and type, the value of
SetIdentifier
must be unique for each resource record set.For information about routing policies, see Choosing a routing policy in the Amazon Route 53 Developer Guide.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
SetIdentifier
property of anAWS::Route53::RecordSetGroup
RecordSet
data type.
Examples
Basic example
In this example, we configure a custom domain and Route 53 record sets for our API.
YAML
Resources: MyApi: Type: AWS::Serverless::Api Properties: StageName: Prod Domain: DomainName:
www.example.com
CertificateArn:arn:aws:acm:us-east-1:123456789012:certificate/abcdef12-3456-7890-abcd-ef1234567890
EndpointConfiguration: REGIONAL Route53: HostedZoneId:ABCDEFGHIJKLMNOP