AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Serverless patterns - Amazon API Gateway Custom Domain Name Parameters: DomainName: Type: String CertificateArn: Type: String PublicHostedZoneId: Type: String ApiId: Type: String Stage: Type: String Resources: CustomDomainRegional: Type: AWS::ApiGatewayV2::DomainName Properties: DomainName: !Ref DomainName DomainNameConfigurations: - SecurityPolicy: TLS_1_2 CertificateArn: !Ref CertificateArn EndpointType: REGIONAL MappingRegional: Type: AWS::ApiGatewayV2::ApiMapping DependsOn: - CustomDomainRegional Properties: DomainName: !Ref DomainName ApiId: !Ref ApiId Stage: !Ref Stage Route53AliasRecordRegional: Type: AWS::Route53::RecordSet DependsOn: - CustomDomainRegional Properties: Name: !Ref DomainName Type: A HostedZoneId: !Ref PublicHostedZoneId AliasTarget: DNSName: !GetAtt CustomDomainRegional.RegionalDomainName HostedZoneId: !GetAtt CustomDomainRegional.RegionalHostedZoneId Outputs: # Custom Domain Name endpoint to be used during tests CustomDomainNameEndpoint: Description: Custom Domain Name endpoint Value: !Sub "https://${DomainName}"