- Newest
- Most votes
- Most comments
The issue you're experiencing is related to base path mappings that are still associated with your API, even though they may not be visible in the console or through standard CLI commands. This can happen when there are lingering associations between your API and custom domain names.
To resolve this issue, you'll need to remove the base path mappings before you can delete the API. Here's a step-by-step approach to tackle this problem:
-
First, try to delete the base path mapping using the AWS CLI. Use the following command:
aws apigateway delete-base-path-mapping --domain-name api.stakepara.com --base-path 'dev'
Replace 'dev' with the appropriate base path if it's different. If you're unsure of the base path, you might need to try variations like '' (empty string) for the root path.
-
If the above command doesn't work or you're unsure of the exact base path, you can try to delete the API mapping instead:
aws apigatewayv2 delete-api-mapping --api-mapping-id [API_MAPPING_ID] --domain-name api.stakepara.com
You'll need to replace [API_MAPPING_ID] with the actual ID of the API mapping. If you don't know this ID, you may need to list all API mappings for the domain and identify the correct one.
-
If these steps don't resolve the issue, you might need to delete the custom domain name entirely:
aws apigateway delete-domain-name --domain-name api.stakepara.com
-
After successfully removing the base path mappings or the custom domain, try deleting the API again using:
aws apigateway delete-rest-api --rest-api-id zg8azx8n80
If you're still encountering issues after trying these steps, it's possible that there might be some inconsistency in the API Gateway backend. In such cases, it's best to contact AWS Support for further assistance. They can help investigate any hidden associations or backend issues that might be preventing the API deletion.
Remember to be cautious when deleting resources, especially in production environments, as these actions are irreversible and could impact your applications if not done carefully.
Sources
delete-base-path-mapping — AWS CLI 2.19.0 Command Reference
Cannot delete API | AWS re:Post
delete-api-mapping — AWS CLI 2.19.1 Command Reference
delete-rest-api — AWS CLI 2.19.0 Command Reference
Hi,
Try from the CLI:
aws apigateway delete-base-path-mapping --domain-name stakepara.com --base-path "(none)"
Then the deletion of the GTW APIs should work
Best,
Didier
Hi, thanks. there is no such mapping. It's there there when i check the dashboard or when i list through the cli. Also, trying to delete it results to this:
An error occurred (NotFoundException) when calling the DeleteBasePathMapping operation: Invalid domain name identifier specified
Also
C:\Users\itsio>aws apigateway get-base-path-mappings --domain-name stakepara.com
An error occurred (NotFoundException) when calling the GetBasePathMappings operation: Invalid domain name identifier specified
That's why this is so weird. AWS will not let me delete the api gateway for api.satkepara.com (and other apis) because of a custom mapping that does not exist.
This probably happened cause i moved some domains from AWS to another registrar, and also deleted the records in Route 53. My guess is that this resulted to automatic removal of the customd omain records in api gateway, but some flags were not updated on the apis themselves.
Relevant content
- asked a year ago
- asked 8 years ago
- asked 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 11 days ago
On 1, there is no such base path, On 2, there is no mapping. On 3, there is no domain entry in route 53 for this (for the entire domain) On 4, we have tried both the cli and the dashbaord, same error.