Invalid domain name identifier specified


Solution 1

Quoting from AWS forums:

You can only create or modify base path mappings after the domain name has been added to API Gateway. This "Invalid domain name identifier specified" error message is returned when the domain name given in the base path mapping is not found, indicating that it has not been added yet.

Also, as of March 2017, the only way to add domain name to the API Gateway via CloudFormation is via custom resources that CloudFormation offers.


Solution 2

It is now possible to just do that. You just have to explicit state on your CFN template that there is a dependency (DependsOn):

  Type: 'AWS::ApiGateway::BasePathMapping'
    BasePath: v1.0
    Stage: dev
    RestApiId: !Ref MobileApiDev
  - MobileApiDevDomain
Jacob Lambert
Author by

Jacob Lambert

Updated on June 23, 2022


  • Jacob Lambert
    Jacob Lambert 3 months

    When trying to create an AWS::ApiGateway::BasePathMapping through CloudFormation, I am given the following error:

    Invalid domain name identifier specified

    Below is the portion(s) of my CloudFormation template that should create the AWS::ApiGateway::BasePathMapping:

        "Parameters": {
            "ApiDomainName": {
                "Description": "The domain name for the API",
                "Type": "String"
        "Resources": {
            "ApiBasePathMapping": {
                "Type": "AWS::ApiGateway::BasePathMapping",
                "Properties": {
                    "DomainName": {
                        "Ref": "ApiDomainName"   
                    "RestApiId": {
                        "Ref": "RepositoryApi"
                    "Stage": {
                        "Ref": "ApiProductionStage"
                "DependsOn": [

    The documentation makes no mention that it needs to be anything special for the DomainName, but the documentation for this resource seems to be lacking some information (It doesn't list outputs for example even though there is a Distribution Domain Name created as an example).

    The remainder of the stack works as expected. I am trying to add this resource in as a Change Set. I do own the domain I am trying to use, and I have created a certificate in ACM for this domain.