How can I resolve errors when deleting custom domain names with API Gateway?

2 minute read
0

I tried to delete a custom domain name for Amazon API Gateway. However, I received an error when calling the DeleteDomainName API action.

Resolution

Follow these instructions for the error message received with your scenario.

An error occurred (AccessDeniedException) when calling the DeleteDomainName API

AWS Identity and Access Management (IAM) identity-based policies determine if the API Gateway resources can be deleted.

Check to confirm that the API caller has the necessary permission to delete a custom domain. The IAM policy attached to the client trying to delete the custom domain should have permissions similar to the following:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "apigateway:Delete"
        ],
      "Resource": "arn:aws:apigateway:*::/*"
    }
  ]
}

For more information, see Policy best practices.

An error occurred (TooManyRequestsException) when calling the DeleteDomainName API

The API Gateway quota for the DeleteDomainName API request is 1 request every 30 seconds per account. This limit can't be increased. If you tried to delete a custom domain using the AWS CLI or SDK with a built-in retry mechanism, the request might fail. This is because the quota has been reached of 1 request every 30 seconds.

To resolve this, use exponential backoff and jitter in the error retry so that there are progressively longer delays between retry attempts.


Related information

Exponential backoff and jitter

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago