Layering Controls on Amazon API Gateway Endpoints
This lesson explains the layered controls of Amazon API Gateway, who can call, from where, how often and with what credentials, and which API type supports which control.
Learning outcomes
After completing this lesson, you will be able to:
- Combine resource policies, authorizers, mutual TLS and throttling.
- Identify which controls each API type supports.
- Explain how back-end services are protected from direct access and malformed requests.
Controls by layer
API Gateway offers several layers of control, and not every control is available for every API type. Two controls decide where calls may come from. Resource policies allow or deny calls by account, IP range, VPC or VPC endpoint, and private APIs can be reached only through interface VPC endpoints; both apply to REST APIs. Several authorisation options decide who may call. IAM authorisation requires requests signed with AWS credentials (SigV4) and works with all API types. Cognito user pool authorizers on REST APIs, and JWT authorizers on HTTP APIs, accept tokens issued to signed-in end users. Lambda authorizers run custom logic and cache the result.
Mutual TLS on custom domains requires clients to present certificates trusted by a trust store in S3. AWS WAF filters requests and applies rate limits at layer 7. It attaches directly to REST APIs and protects other types through CloudFront. Throttling limits request rates on every stage, and usage plans enforce per-client quotas on REST APIs. The following table summarises the controls.
| Control | Purpose | API types |
|---|---|---|
| Resource policies | Allow or deny by account, IP range, VPC or VPC endpoint | REST |
| Private APIs | Reachable only through interface VPC endpoints | REST |
| IAM (SigV4) authorisation | AWS principals call with signed requests | REST, HTTP, WebSocket |
| Cognito user pool authorizers | End users with Cognito tokens | REST |
| JWT authorizers | Tokens from any OIDC provider | HTTP |
| Lambda authorizers | Custom token or request logic, with result caching | REST, HTTP, WebSocket |
| Mutual TLS | Clients present certificates from a trust store in S3 | REST, HTTP (custom domains) |
| AWS WAF | Layer 7 filtering and rate limiting | REST (and through CloudFront for others) |
| Throttling and usage plans | Limit abuse and enforce per-client quotas | REST (usage plans), all (stage throttling) |
The following diagram shows the three controls a request from a partner passes on its way to a private API.

Who, where or how often?
Protecting the back end
The services behind an API must be protected from direct access and malformed requests. The following list describes the relevant measures.
- Back-end services should accept traffic only from API Gateway: a private integration through VPC Link, a Lambda resource policy naming the API's ARN, or a client certificate that API Gateway presents to an HTTP back end.
- Disable the default
execute-apiendpoint when a custom domain with mutual TLS is used, so clients cannot bypass certificate checks. - Request validation rejects malformed input before it reaches code.
- Access logs (with identity, IP and authorizer results) and execution logs go to CloudWatch Logs; avoid logging full request bodies containing personal data.
Protecting what sits behind the API
An API restricted to a partner's network and certificate
A partner integration must be callable only from the partner's published IP range, only with a client certificate issued by the company's private CA, and never through the default endpoint. A resource policy handles the network restriction:
{
"Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "execute-api:/*" },
{ "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": "execute-api:/*",
"Condition": { "NotIpAddress": { "aws:SourceIp": ["198.51.100.0/24"] } } }
]
}aws apigateway create-domain-name --domain-name partners.api.example.com \
--regional-certificate-arn $ACM_CERT_ARN --endpoint-configuration types=REGIONAL \
--security-policy TLS_1_2 \
--mutual-tls-authentication truststoreUri=s3://acme-truststores/partners.pem
aws apigateway update-rest-api --rest-api-id $API_ID \
--patch-operations op=replace,path=/disableExecuteApiEndpoint,value=trueEach control covers a different threat: the IP condition stops unknown networks, mutual TLS proves the caller holds a valid certificate, and disabling the default endpoint prevents both being bypassed. A WAF web ACL adds rate limiting and managed rules for the request content.
Which REST API type is not reachable from the internet?
Show answer
A private REST API, reached through an interface VPC endpoint.
Exam Tips
Remember for the exam
- To allow API calls only from certain IP ranges or VPC endpoints, use an API Gateway resource policy.
- For APIs that must not be reachable from the internet, use private REST APIs.
- For client certificate authentication, configure mutual TLS on a custom domain and disable the default endpoint.
- HTTP APIs use JWT authorizers; REST APIs support Cognito authorizers, usage plans and WAF directly.
- To make a Lambda back end callable only by one API, use a Lambda resource policy with the API's source ARN.