Is it possible in AWS API Gateway to "turn off"/"disable" an API in API Gateway, without deleting the API itself? I'm hoping to keep the configuration of an API, without losing it through the otherwise deletion I'm hoping to avoid; that would also have the beneficial parallel motivation of preventing AWS billed API usage.
Is it possible, or is delete the only option?
There is no disable button, but there are two possibilities that can be considered as a workaround:
Deny
resource base policy to the API.{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "execute-api:/{{stageNameOrWildcard}}/{{httpVerbOrWildcard}}/{{resourcePathOrWildcard}}"
}
]
}
The policy will Deny all invocations of the API, making it effectively disabled. But the invocations will still count towards API usage.