How can I resolve "CNAMEAlreadyExists" and "Too Many Requests" errors when I create an edge-optimized custom domain name for my API Gateway API?

Last updated: 2021-05-11

I get "CNAMEAlreadyExists" and "Too Many Requests" errors when I try to create an edge-optimized custom domain name for my Amazon API Gateway API.

Short description

You get errors in API Gateway when a CNAME record for the custom domain name already exists and points to an Amazon CloudFront distribution. This can happen when you're trying to recreate an edge-optimized custom domain name that you previously deleted.

It's not uncommon to receive "Too Many Requests" errors when you make several custom domain name updates in a short timeframe. These errors happen because of the low quota for UpdateDomainName (one request every 30 seconds per account). For more information, see API Gateway quotas for creating, deploying and managing an API.

Important: You can't use the same CNAME record for more than one CloudFront distribution.

To resolve these errors and create an edge-optimized custom domain name, you must first delete the existing CNAME record pointing to a CloudFront distribution.


Confirm if the custom domain name previously existed

1.    To confirm if the custom domain name previously existed, run a DNS lookup command on the domain name.

On Linux, Unix, or macOS systems:

dig +all

On Windows:


Note: Replace with your domain name.

2.    If the custom domain name previously existed and its DNS record is still there, then use dig to get the CNAME record in the output:

abc.example.comcom. 0        IN    CNAME

Important: You must delete this record before you can create the custom domain name.

If the output shows an A record (IPv4 address) instead of a CNAME record, then you must update the record. The updated record must point the custom domain name (A alias) to the CloudFront distribution.

Use either a CNAME record or an A record. The CNAME record resolves to another domain name. An A record resolves to IP addresses. Choose the option that best fits your use case, requirements, and constraints. For more information, see Comparison of alias and CNAME records. The custom domain name confirmation for both options is the same. For guidelines, see steps 9 and 10 of Set up an edge-optimized custom domain name for an API Gateway API.

Delete the existing CNAME record

Choose one of the following options based on the DNS service provider for your domain.

If you have a third-party DNS service provider, then do the following:

1.    Follow your provider's process to delete the CNAME record set that points to your CloudFront distribution.

2.    If you're using CloudFront, update your distribution and remove the alternate domain names (that is, CNAMEs).

Note: If you receive "CNAMEAlreadyExists" errors, see How do I resolve the error CNAMEAlreadyExists when setting up a CNAME alias for my Amazon CloudFront distribution?


If you have Amazon Route 53, delete the record in Route 53 that points to CloudFront.

Note: Wait several minutes for the DNS change to propagate before retrying to create the custom domain name in API Gateway.