I tried to delete a custom domain name for Amazon API Gateway. However, I received an error when calling the DeleteDomainName API action.
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:
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.
Exponential backoff and jitter