Is there a way to Delete a Amazon API Gateway from the aws cli ?
I created a bunch of gateways, and it takes a while to remove them from the GUI. Is there a way to do it from aws cli
Couldn't find any examples anywhere
Yes, you can delete the APIs using AWS CLI. To delete a Rest API using CLI, we need the rest API id. To get that, run the get-rest-apis
CLI and then delete it.
Here's a script to delete all the rest APIs:
for rest_api_id in $(aws apigateway get-rest-apis --region us-east-1 --query 'items[*].id' --output text); do aws apigateway delete-rest-api --region us-east-1 --rest-api-id $rest_api_id ; done
Of course this will delete all the APIs. To delete selectively, run the commands separately.
References: