AWS cannot delete RestApi

10.7k Views Asked by At

On deleting AWS Rest API from UI or through AWS console or terminal with command:

aws apigateway delete-rest-api --rest-api-id 1234123412

(mentioned in aws docs) I faced the error saying to delete base-path mappings related to RestApi in your domain, I tried deleting it with the following cmd given in aws docs:

aws apigateway delete-base-path-mapping --domain-name 'api.domain.tld' --base-path 'dev'

I got error: An error occurred (NotFoundException) when calling DeleteBasePathMapping operation. Invalid base path mapping identifier specified

2

There are 2 best solutions below

0
On

Delete the corresponding domain name from the UI (under 'Custom domain names').

After which, the RestApi can be deleted.

0
On

Try this:

aws apigateway delete-base-path-mapping --domain-name domain.tld --base-path "(none)"

Reference: https://docs.aws.amazon.com/cli/latest/reference/apigateway/delete-base-path-mapping.html