- Newest
- Most votes
- Most comments
Yes, requests to the disabled default execute-api endpoint are still billed by API Gateway as "API calls received," even if they return 403 Forbidden.
Disabling the endpoint only changes the response code; it does not prevent the request from hitting API Gateway and being counted for billing.
Billing details:
API Gateway charges per API call received (first million free/month, then tiered ~$3.50/million in US East), regardless of:
- HTTP status code (200, 403, 500, etc.)
- Whether the default endpoint is disabled
- Authorization failure
Data transfer out (if any response body) is also charged (~$0.09/GB).
answered 10 months ago
When you disable the default endpoint for an API Gateway REST API, clients can still connect to the endpoint but will receive a 403 Forbidden status code. According to Amazon API Gateway's pricing model, you pay only for the API calls you receive and the amount of data transferred out.
Since the request to a disabled default endpoint is still received and processed by API Gateway (even though it results in a 403 response), these requests would still be counted as API calls for billing purposes. The pricing is based on the API calls received, regardless of the response code returned.
After disabling the default endpoint, you'll need to redeploy your API for the change to take effect. This ensures that clients can only access your API through your custom domain name, if configured.
Sources
Disable the default endpoint for REST APIs - Amazon API Gateway
Amazon API Gateway Pricing
answered 10 months ago
Amazon CloudFront provides a clear precedent: requests blocked by AWS WAF do not incur CloudFront charges. Effective October 25, 2024, all CloudFront requests blocked by AWS WAF are free of charge, meaning CloudFront customers never incur request fees or data transfer charges for requests blocked by AWS WAF, refer [1]. AWS WAF continues billing for evaluating and blocking these requests, but the underlying service (CloudFront) does not charge for the blocked traffic.
Additionally, when using CloudFront flat-rate pricing plans, blocked DDoS attacks and requests blocked by AWS WAF never count against your usage allowance. Refer [2]
[2] https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/flat-rate-pricing-plan.html
The ideal approach would be:
- Use a regional API Gateway endpoint with a custom domain
- Place CloudFront in front of API Gateway with a flat-rate pricing plan
- Configure CloudFront to insert a custom header or API key that API Gateway validates
- Use AWS WAF at the CloudFront level to block malicious traffic before it reaches API Gateway
- Configure rate limiting in both CloudFront/WAF and API Gateway
This architecture ensures that malicious traffic is blocked at the CloudFront edge with predictable costs under the flat-rate plan, and requests blocked by WAF don't incur CloudFront charges.
Comment here if you have additional questions, happy to help.
-- Abhishek
Relevant content
asked 3 years ago
