AWS API Gateway
apigateway.aws
Protects against destructive AWS API Gateway CLI operations for both REST APIs and HTTP APIs.
- 18blocking rules
- 27safe patterns
- 2Critical
- 11High
- 5Medium
[packs]
enabled = ["apigateway.aws"]Evaluated when a command contains aws, apigateway, apigatewayv2.
Blocking rules
Each rule ID is apigateway.aws:<name>. Use it in allowlists and [policy.rules].
Criticalapigateway-delete-rest-apiaws apigateway delete-rest-api permanently removes a REST API and all its resources.
Explanation
Deleting a REST API removes all resources, methods, stages, deployments, and configurations. All clients will immediately receive errors. API keys and usage plans referencing this API become orphaned but are not automatically deleted. Safer alternatives: - aws apigateway get-rest-api: Review API details before deletion - aws apigateway get-stages: Check active stages and traffic - Export API definition with aws apigateway get-export first
Criticalapigatewayv2-delete-apiaws apigatewayv2 delete-api permanently removes an HTTP API.
Explanation
Deleting an HTTP API removes all routes, integrations, stages, and configurations. All clients will immediately lose access. WebSocket connections are terminated. The API ID cannot be reused. Safer alternatives: - aws apigatewayv2 get-api: Review API details first - aws apigatewayv2 export-api: Export OpenAPI spec for backup - Verify no production traffic before deletion
Highapigateway-delete-api-keyaws apigateway delete-api-key removes an API key.
Explanation
Deleting an API key immediately revokes access for any client using that key. Requests will be rejected with 403 Forbidden. Usage tracking history for the key is preserved but the key cannot be recovered. Safer alternatives: - aws apigateway get-api-key: Review key details first - Disable the key instead of deleting to preserve for audit - Notify affected clients before deletion
Highapigateway-delete-authorizeraws apigateway delete-authorizer removes an authorizer from an API.
Explanation
Deleting an authorizer breaks authentication for all methods using it. Those methods will fail authorization until reconfigured. Lambda authorizer functions are not deleted but become orphaned. Safer alternatives: - aws apigateway get-authorizers: Review authorizers first - Update methods to use a different authorizer before deletion - Test in a non-production stage first
Highapigateway-delete-domain-nameaws apigateway delete-domain-name removes a custom domain name.
Explanation
Deleting a custom domain name breaks all traffic using that domain. The ACM certificate is not deleted but becomes unused. DNS records pointing to the domain will fail to resolve API traffic. Safer alternatives: - aws apigateway get-domain-names: Review domains first - Update DNS records before domain deletion - Verify no production traffic uses this domain
Highapigateway-delete-resourceaws apigateway delete-resource removes an API resource and its methods.
Explanation
Deleting a resource removes the URL path and all HTTP methods defined on it. Clients calling that endpoint will receive 404 errors. Child resources are also deleted recursively. Safer alternatives: - aws apigateway get-resources: Review resource tree first - Deploy to a test stage to verify the change - Delete individual methods instead if only removing specific operations
Highapigateway-delete-stageaws apigateway delete-stage removes a deployment stage from an API.
Explanation
Deleting a stage stops all traffic to that deployment. Stage variables, caching settings, and throttling configurations are lost. Clients using the stage URL will receive errors immediately. Safer alternatives: - aws apigateway get-stage: Review stage settings first - Redirect traffic to another stage before deletion - Export stage configuration for backup
Highapigateway-delete-usage-planaws apigateway delete-usage-plan removes a usage plan.
Explanation
Deleting a usage plan removes throttling and quota limits for associated API keys. Keys lose their rate limiting, which may cause backend overload or unexpected billing. Key associations are removed. Safer alternatives: - aws apigateway get-usage-plans: Review plans first - aws apigateway get-usage-plan-keys: Check associated keys - Migrate keys to another plan before deletion
Highapigatewayv2-delete-authorizeraws apigatewayv2 delete-authorizer removes an authorizer from an HTTP API.
Explanation
Deleting an authorizer breaks authentication for routes using it. JWT validation and Lambda authorization will fail. Routes must be updated to remove or replace the authorizer reference. Safer alternatives: - aws apigatewayv2 get-authorizers: Review authorizers first - Update routes to use a different authorizer - Test authorization changes in a test stage
Highapigatewayv2-delete-domain-nameaws apigatewayv2 delete-domain-name removes a custom domain name from an HTTP API.
Explanation
Deleting a custom domain breaks traffic using that hostname. API mappings are removed. DNS records will fail to route to the API. The ACM certificate remains but becomes unused. Safer alternatives: - aws apigatewayv2 get-domain-names: Review domains first - Update DNS before deletion - Remove API mappings first to verify impact
Highapigatewayv2-delete-integrationaws apigatewayv2 delete-integration removes an integration from an HTTP API.
Explanation
Deleting an integration breaks routes using it. Those routes will fail to invoke backend services. Lambda function configurations, HTTP endpoints, and VPC link settings are lost. Safer alternatives: - aws apigatewayv2 get-integrations: Review integrations first - Check which routes use this integration - Update routes to use a different integration first
Highapigatewayv2-delete-routeaws apigatewayv2 delete-route removes a route from an HTTP API.
Explanation
Deleting a route removes the path and method combination from the API. Clients calling that endpoint will receive 404 errors. Route authorization settings and request validation are also removed. Safer alternatives: - aws apigatewayv2 get-routes: List routes first - Test in $default stage before production - Consider updating the route instead of deleting
Highapigatewayv2-delete-stageaws apigatewayv2 delete-stage removes a stage from an HTTP API.
Explanation
Deleting a stage stops all traffic to that deployment. Stage variables, access logs, throttling, and auto-deploy settings are lost. Clients using the stage URL will receive errors. Safer alternatives: - aws apigatewayv2 get-stages: Review stages first - Redirect traffic before deletion - Keep $default stage for production traffic
Mediumapigateway-delete-deploymentaws apigateway delete-deployment removes a deployment from an API.
Explanation
Deleting a deployment removes a specific API snapshot. If the deployment is currently active on a stage, that stage becomes unavailable. Rollback to this version becomes impossible after deletion. Safer alternatives: - aws apigateway get-deployments: List deployments first - Ensure no stages reference this deployment - Keep recent deployments for rollback capability
Mediumapigateway-delete-methodaws apigateway delete-method removes an HTTP method from a resource.
Explanation
Deleting a method removes the HTTP operation (GET, POST, etc.) from a resource. Clients calling that method will receive 404 or 405 errors after redeployment. Safer alternatives: - aws apigateway get-method: Review method configuration first - Test changes in a non-production stage - Consider disabling the method instead of deleting
Mediumapigateway-delete-modelaws apigateway delete-model removes a model from an API.
Explanation
Deleting a model removes the JSON schema definition. Methods referencing this model for request/response validation will lose that validation. The API will still function but without schema enforcement. Safer alternatives: - aws apigateway get-models: Review models first - Check which methods reference this model - Update method configurations to remove model references first
Mediumapigatewayv2-delete-integration-responseaws apigatewayv2 delete-integration-response removes an integration response.
Explanation
Deleting an integration response removes response mapping for WebSocket APIs. Template transformations and response codes are lost. Clients may receive raw backend responses. Safer alternatives: - aws apigatewayv2 get-integration-responses: Review first - Test response handling in a test stage - Update the response instead of deleting
Mediumapigatewayv2-delete-route-responseaws apigatewayv2 delete-route-response removes a route response from an HTTP API.
Explanation
Deleting a route response removes response configuration for WebSocket APIs. Response selection expressions and model mappings are lost. Clients may receive unexpected response formats. Safer alternatives: - aws apigatewayv2 get-route-responses: Review responses first - Test in a non-production stage - Update response instead of deleting
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
apigateway-get-rest-apiapigateway-get-rest-apisapigateway-get-resourcesapigateway-get-resourceapigateway-get-methodapigateway-get-stagesapigateway-get-stageapigateway-get-deploymentsapigateway-get-deploymentapigateway-get-api-keysapigateway-get-api-keyapigateway-get-authorizersapigateway-get-modelsapigateway-get-usage-plansapigateway-get-domain-namesapigatewayv2-get-apisapigatewayv2-get-apiapigatewayv2-get-routesapigatewayv2-get-routeapigatewayv2-get-integrationsapigatewayv2-get-integrationapigatewayv2-get-stagesapigatewayv2-get-stageapigatewayv2-get-authorizersapigatewayv2-get-domain-namesapigateway-helpapigatewayv2-help