Configures a custom domain for an API.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
BasePath: List
CertificateArn: String DomainName: String
EndpointConfiguration: String
MutualTlsAuthentication: MutualTlsAuthentication OwnershipVerificationCertificateArn: String Route53: Route53Configuration (p. 62) SecurityPolicy: String
Properties
BasePath
A list of the basepaths to configure with the Amazon API Gateway domain name.
Type: List Required: No Default: /
AWS CloudFormation compatibility: This property is similar to the BasePath property of an AWS::ApiGateway::BasePathMapping resource. AWS SAM creates multiple
AWS::ApiGateway::BasePathMapping resources, one per BasePath specified in this property.
CertificateArn
The Amazon Resource Name (ARN) of an AWS managed certificate this domain name's endpoint.
AWS Certificate Manager is the only supported source.
Type: String Required: Yes
AWS CloudFormation compatibility: This property is similar to the CertificateArn property of an AWS::ApiGateway::DomainName resource. If EndpointConfiguration is set to REGIONAL (the default value), CertificateArn maps to RegionalCertificateArn in AWS::ApiGateway::DomainName. If the EndpointConfiguration is set to EDGE, CertificateArn maps to CertificateArn in AWS::ApiGateway::DomainName.
Additional notes: For an EDGE endpoint, you must create the certificate in the us-east-1 AWS Region.
DomainName
The custom domain name for your API Gateway API. Uppercase letters are not supported.
AWS SAM generates an AWS::ApiGateway::DomainName resource when this property is set.
For information about this scenario, see DomainName property is specified (p. 184). For
information about generated AWS CloudFormation resources, see Generated AWS CloudFormation resources (p. 181).
Type: String Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the DomainName property of an AWS::ApiGateway::DomainName resource.
EndpointConfiguration
Defines the type of API Gateway endpoint to map to the custom domain. The value of this property determines how the CertificateArn property is mapped in AWS CloudFormation.
Valid values: REGIONAL or EDGE Type: String
Required: No Default: REGIONAL
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
MutualTlsAuthentication
The mutual Transport Layer Security (TLS) authentication configuration for a custom domain name.
Type: MutualTlsAuthentication Required: No
AWS CloudFormation compatibility: This property is passed directly to the
MutualTlsAuthentication property of an AWS::ApiGateway::DomainName resource.
OwnershipVerificationCertificateArn
The ARN of the public certificate issued by ACM to validate ownership of your custom domain.
Required only when you configure mutual TLS and you specify an ACM imported or private CA certificate ARN for the CertificateArn.
Type: String Required: No
AWS CloudFormation compatibility: This property is passed directly to the
OwnershipVerificationCertificateArn property of an AWS::ApiGateway::DomainName resource.
Route53
Defines an Amazon Route 53 configuration.
Type: Route53Configuration (p. 62) Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent.
SecurityPolicy
The TLS version plus cipher suite for this domain name.
Type: String Required: No
AWS CloudFormation compatibility: This property is passed directly to the SecurityPolicy property of an AWS::ApiGateway::DomainName resource.
Examples
DomainName
DomainName exampleYAML
Domain:
DomainName: www.example.com CertificateArn: arn-example EndpointConfiguration: EDGE Route53:
HostedZoneId: Z1PA6795UKMFR9 BasePath:
- /foo - /bar
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
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 an AWS::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 an AWS::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 or HostedZoneId, but not both. If you have multiple hosted zones with the same domain name, you must specify the hosted zone using HostedZoneId.
Type: String Required: No
AWS CloudFormation compatibility: This property is passed directly to the HostedZoneId property of an AWS::Route53::RecordSetGroup RecordSet resource.
HostedZoneName
The name of the hosted zone that you want to create records in.
Specify either HostedZoneName or HostedZoneId, but not both. If you have multiple hosted zones with the same domain name, you must specify the hosted zone using HostedZoneId.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the HostedZoneName property of an AWS::Route53::RecordSetGroup RecordSet resource.
IpV6
When this property is set, AWS SAM creates a AWS::Route53::RecordSet resource and sets Type to AAAA 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.
Examples
Route 53 Configuration Example
This example shows how to configure Route 53.
YAML
Domain:
DomainName: www.example.com CertificateArn: arn-example EndpointConfiguration: EDGE Route53:
HostedZoneId: Z1PA6795UKMFR9 EvaluateTargetHealth: true DistributionDomainName: xyz