API Gateway connects client requests or WebSocket messages to backend services. These sections cover REST deployments, integrations, access controls and operations, plus HTTP API authorization and WebSocket routing.
API Gateway basics
Amazon API Gateway is a managed front door for APIs that call Lambda functions or other backends.
How it works
- Define the API and its routes.
- Connect each route to a backend such as Lambda.
- Clients call the API through API Gateway.
Exam cues
- If the question says create or secure an API, think API Gateway.
Remember
- REST, HTTP and WebSocket APIs.
Trap: API Gateway exposes APIs; it does not run the business logic, which lives in the backend.
Deployments and stages
A REST API deploymentA fixed snapshot of a REST API configuration that a stage can expose to callers. is a fixed snapshot of the API configuration. A stageA named reference to a deployed API configuration that clients can invoke. is the named reference clients use to reach a deployment, allowing a release to be attached to a new or existing stage.
How it works
- Define the API resources, methodsAn HTTP operation on an API resource that defines how a client accesses it. and integrationsThe configuration that connects an API method to a backend endpoint., the connections to backend services.
- Create a deployment containing that configuration and associate it with a stage.
- After resource or integration changes, deploy the updated API to the stage. Updates to stage settings or usage plansA set of deployed API stages and request targets associated with client API keys. do not require redeployment.
- Use stage variables, per-stage key-value settings, to select a backend URL or Lambda version or aliasAn updatable named pointer to a Lambda function version.. A Lambda alias is an updatable pointer to a function version.
- Configure Lambda invoke permissions manually for stage-variable targets. The selected function must belong to the API’s account.
- Provision a stage cache and enable method caching to serve cached responses and reduce calls to the endpoint.
- Roll back an API snapshot by changing the stage’s active deployment to an earlier deployment. Configure an API Gateway account IAM roleAn identity that a user, application or service assumes to obtain a set of permissions. for CloudWatch Logs when enabling stage logging.
- Select request parameters as cache keysSelected request values used to distinguish entries in the response cache. when responses differ by those parameters.
Exam cues
- If the question says a REST API integration edit is invisible to callers, think create and associate a new deployment, because the stage still references an earlier snapshot.
- If the question says test and production should call different Lambda aliases, think stage variables plus explicit invoke permissions, because selecting a function does not grant permission to call it.
- If the question says HTTP API changes publish automatically, think automatic deployments on that HTTP API stage, because that option releases changes without a manual deployment.
- If the question says reduce repeated backend calls, think REST API stage caching, because cached responses can be served without calling the endpoint.
- If an API Gateway deployment breaks production, think changing the active deployment back to an earlier snapshot.
- If requests with different query values receive the same cached response, include the distinguishing parameter in the cache key.
- If CloudFormation deploys a REST API before its methods exist, add deployment dependencies on the methods.
Remember
- Resource changes need deployment; stage configuration changes do not.
- Keep credentials out of stage variables.
Trap: A stage variableA key-value configuration setting used by an API stage and its integrations. containing a Lambda target does not create its invoke permission. Configure that permission on the selected target.
Create an immutable deployment from the API configuration.
Associate the deployment with a new or existing stage for callers.
Da documentação da AWS (19)
- A REST API Deployment is an immutable representation of an API.
- A deployment must be associated with a stage before callers can invoke it.
- A REST API deployment can be associated with a new or existing stage.
- REST API resource, method, integration, authorizer and model updates require redeployment.
- REST API stage configuration updates do not require redeployment.
- REST API usage plan configuration updates do not require redeployment.
- Stage variables are per-stage key-value configuration used to select backend URLs or pass integration settings.
- Stage variables can substitute a Lambda function name, version or alias in an integration URI.
- When a Lambda function name is supplied through a stage variable, its invoke permission must be configured manually.
- Lambda functions referenced through stage variables must be in the same account as the API.
- Stage variables are not intended to hold sensitive data such as credentials.
- HTTP API stages can enable automatic deployments so API changes are released automatically.
- A Lambda alias is an updatable pointer to a function version.
- With a provisioned API Gateway REST API stage cache and method caching enabled, cached responses can be served instead of calling the endpoint, reducing calls.
- A REST API stage can be pointed to an earlier deployment to roll back the API snapshot.
- REST API cache keys can include request parameters such as headers, paths, or query strings; requests sharing the selected key can reuse a cached response.
- CloudWatch Logs for a REST API stage requires an IAM role configured on the API Gateway account that permits API Gateway to write logs.
- When a CloudFormation template creates a REST API, its methods and its deployment together, the deployment must depend on the methods.
- Amazon API Gateway creates, publishes and secures REST, HTTP and WebSocket APIs and acts as a front door to backends such as Lambda functions, EC2 and web applications.
Canary releases
A canary releaseA release that receives a selected random share of requests while the base version serves the rest. tests a new REST API deploymentA fixed snapshot of a REST API configuration that a stage can expose to callers. with a share of real requests on an existing stageA named reference to a deployed API configuration that clients can invoke.. API Gateway selects requests randomly, while the base deployment handles the remaining traffic.
How it works
- Add
canarySettingsto the stage, including the canarydeploymentIdandpercentTraffic. - Use
stageVariableOverrideswhen the test deployment needs different backend settings. - Inspect canary logs and metrics. With logging enabled, the canary execution logA log of the actions and errors involved in processing API requests. group ends in
/Canary. - Promote the release by copying its deployment ID and stage variables to the base stage and setting canary traffic to 0.0%.
- Remove canary settings to disable the canary configuration.
Exam cues
- If the question says expose a new REST API deployment to a small random share of requests, think a stage canary, because the base and test versions can share a stage.
- If the question says promotion succeeded but the stage still has a canary configuration, think remove canary settings, because promotion alone does not disable it.
- If the question says the canary needs a different backend value, think
stageVariableOverrides, because those values override the base stage variables.
Remember
percentTrafficaccepts 0.0 through 100.0 inclusive.- Canary caching requires both
useStageCacheand an enabled stage cache. - Different deployments cache separately; equivalent requests to the same deployment share a cache keySelected request values used to distinguish entries in the response cache..
- Remove canary settings before associating the stage with another non-canary deployment.
Trap: Setting canary traffic to 100% sends all requests to it but does not perform the documented promotion steps. Promotion also updates the stage’s deployment and variables.
Clients invoke the same stage.
Random selection leaves the remaining requests on the base deployment.
The configured percentage goes to the canary deployment, with its variable overrides.
Da documentação da AWS (15)
- A canary release randomly sends a configured share of requests to a test deployment while the base deployment serves the rest on the same stage.
- Stage canarySettings includes deploymentId, percentTraffic, stageVariableOverrides and useStageCache.
- Canary traffic percentage can be from 0.0 through 100.0 inclusive.
- Canary stage variables can override the base stage variables.
- Canary requests have separate logs and metrics when logging is enabled.
- The canary execution log group name ends in /Canary.
- useStageCache enables canary caching only if the stage cache is enabled.
- Different base and canary deployments cache responses separately.
- The same base and canary deployment uses a shared cache key for equivalent requests.
- Promotion copies the canary deployment ID to the base stage.
- Promotion copies canary stage variables to the base stage.
- Promotion sets canary traffic to 0.0%.
- Promotion does not disable the stage canary configuration.
- Remove the stage canary settings to disable it.
- While canary is enabled, a stage cannot be associated with another non-canary deployment until the canary settings are removed.
Authentication and API keys
API Gateway access controls decide who may invoke an API. AuthenticationThe process of establishing the identity making a request. checks a caller’s identity; authorizationThe decision about whether an identity may perform a requested action. checks which calls that identity may make. API keysA client identifier used to associate REST API requests with a usage plan. identify clients for usage measurement and throttlingLimiting the target rate of incoming API requests. targets.
How it works
- Choose an access mechanism for the API type and its callers.
- For a REST API using IAM, set
AWS_IAMon the methodAn HTTP operation on an API resource that defines how a client accesses it.. Give the callerexecute-api:Invokeand require a signed request. - Use a Lambda authorizerA component that evaluates caller credentials or tokens to allow or deny API access. for custom access decisions or a Cognito user pool authorizer for REST API users. HTTP APIs also support JWTA signed token containing claims that an HTTP API authorizer can validate. authorizers, which validate a JSON Web Token, a signed token containing identity claimsA value inside a token that describes its issuer, audience, validity or other identity information..
- Separately associate client API keys and deployed stages with a usage planA set of deployed API stages and request targets associated with client API keys. when you need per-client request targets and quotasA target request allowance over a time interval or another documented service limit..
| Control | API type | Purpose |
|---|---|---|
| IAM | REST and HTTP | Authorize calls with AWS identities |
| Lambda authorizer | REST and HTTP | Run custom access logic |
| Cognito user pool authorizer | REST | Control access for user pool users |
| JWT authorizer | HTTP | Validate tokens and configured route scopes |
| API key and usage plan | REST | Identify clients and apply request targets |
Exam cues
- If the question says an AWS workload should invoke an API with its roleAn identity that a user, application or service assumes to obtain a set of permissions. credentials, think IAM authorization and signed requests, because invocation permission belongs to the caller’s AWS identity.
- If the question says an HTTP API must accept identity-provider tokens and require a permission scopeA token permission value that an HTTP API route can require for access., think a JWT authorizer with route scopes, because token validation and scope checks happen before integrationThe configuration that connects an API method to a backend endpoint..
- If the question says measure usage per customer, think API keys and usage plans, because a key identifies the client’s traffic across stages in that plan.
Remember
- REST IAM calls support SigV4An AWS request signing protocol that API Gateway can use to authenticate caller credentials. and SigV4aAn AWS request signing protocol supported for IAM authentication of REST API callers. signatures. SigV4a support was added in August 2025.
- A JWT route with scopes requires at least one matching token scope.
- A key belongs to at most one usage plan for a given stageA named reference to a deployed API configuration that clients can invoke..
- Usage plan quotas are best effort and can be exceeded.
Trap: An API key is not proof of caller identity. It also does not create a hard spending cap or guaranteed request ceiling.
Da documentação da AWS (19)
- A REST API method configured with AWS_IAM requires IAM-authorized signed requests.
- REST API IAM authentication supports SigV4 and SigV4a.
- execute-api:Invoke permits calling deployed API methods.
- API management permissions are separate from API invocation permissions.
- REST API Lambda authorizers use a function to decide access from bearer tokens or request information.
- REST APIs can use Amazon Cognito user pool authorizers to control invocation access.
- REST API resource policies can allow or deny access based on source IP addresses or VPC endpoints.
- HTTP APIs support IAM, Lambda authorizers and JWT authorizers.
- An HTTP API JWT authorizer validates token signatures and claims including issuer, audience and expiration.
- A token must contain at least one configured HTTP API route scope.
- API keys identify clients for REST API usage plans.
- API keys must not be used as API authentication or authorization.
- A usage plan associates API stages and client API keys with request throttling targets and quotas.
- Usage plan throttles and quotas aggregate each key across API stages in the plan.
- An API key can belong to only one usage plan for a given API stage.
- Usage plan throttles and quotas are best-effort targets that clients can exceed; do not rely on them to control costs or block access.
- Authentication establishes the identity making a request.
- Authorization determines whether an identity may perform the requested action.
- API Gateway added SigV4a support for REST APIs in August 2025.
Endpoint types and throttling
API Gateway endpoint type decides where requests enter AWS, and throttlingLimiting the target rate of incoming API requests. decides how many get through.
How it works
- Choose an endpoint type per REST API: edge-optimized, Regional or private.
- Every request takes a token from a bucket that refills at the allowed rate.
- Limits apply from narrowest to widest: usage planA set of deployed API stages and request targets associated with client API keys. per client or methodAn HTTP operation on an API resource that defines how a client accesses it., stageA named reference to a deployed API configuration that clients can invoke. method limits, account per Region, then AWS Regional limits.
- When the bucket is empty, API Gateway answers 429 Too Many Requests.
| Endpoint type | Reach | Fits |
|---|---|---|
| Edge-optimized (REST default) | Nearest CloudFront point of presenceA CloudFront entry location through which an edge-optimized API can receive client requests. | Clients around the world |
| Regional | Same Region | Same-Region clients, your own CloudFront, multi-Region with Route 53 |
| Private | Interface VPC endpointA network interface inside a VPC that provides private access to an AWS service. only | Internal APIs |
Exam cues
- If the question says global clients, think edge-optimized; same-Region or multi-Region with latency routing, think Regional.
- If the question says API reachable only from a VPC, think a private API.
- If the question says 429 errors or protect the backend from burstsThe capacity of the request token bucket used to absorb a short traffic spike., think throttling settings, usage plans and caching.
Remember
- Default account quotaA target request allowance over a time interval or another documented service limit.: 10,000 requests per second, burst 5,000, per Region, shared by all APIs.
- Throttle order: usage plan, stage method, account, AWS Regional.
- 429 means throttled; retry with backoff.
Trap: The account quota is shared by every API in the Region. Without stage or usage plan limits, one busy API can throttle all the others.
Da documentação da AWS (9)
- An edge-optimized API Gateway endpoint routes requests through the nearest CloudFront point of presence, helps geographically distributed clients, and is the default endpoint type for REST APIs.
- A Regional API Gateway endpoint is meant for clients in the same Region, such as EC2 callers, and can sit behind your own CloudFront distribution or use Route 53 latency routing across Regions.
- A private API Gateway endpoint is reachable only from your VPC through an interface VPC endpoint.
- API Gateway throttles with a token bucket per account and Region; requests beyond the rate and burst limits get 429 Too Many Requests, and clients should retry with backoff.
- The default API Gateway throttle quota is 10,000 requests per second per account per Region across HTTP, REST and WebSocket APIs, with a burst bucket of 5,000 requests, and the rate can be raised on request.
- API Gateway applies throttles in this order, per-client or per-method limits in a usage plan, per-method limits on the stage, the account limit per Region, then AWS Regional throttling.
- REST and HTTP APIs in API Gateway give stateless client-server communication, while WebSocket APIs give stateful, full-duplex communication between client and server.
- REST API stage caching returns cached endpoint responses for a TTL that defaults to 300 seconds and can be at most 3,600 seconds; a TTL of 0 turns caching off, and methods can override the stage setting.
- AWS AppSync provides serverless GraphQL and Pub/Sub APIs that read from one or more data sources, such as DynamoDB, through a single GraphQL endpoint; pipeline resolvers run several functions in sequence to resolve one field.
Integrations and monitoring
An integrationThe configuration that connects an API method to a backend endpoint. connects an API methodAn HTTP operation on an API resource that defines how a client accesses it. to its backend. The integration type decides how much mapping you configure.
How it works
- A client calls a method. If request validation is on, API Gateway rejects an invalid request with 400 before going further.
- The integration request sends the call to the backend: as is for proxy types, or through mapping templates for AWS and HTTP custom types.
- The backend has up to the integration timeoutThe configured time API Gateway waits for an integration response before reporting a timeout. to answer (29 seconds by default).
- API Gateway returns the response. With HTTP API CORS configured, it also answers preflight OPTIONS requests automatically.
| Integration type | Backend | Mappings |
|---|---|---|
| AWS_PROXY | Lambda function | None |
| AWS | AWS service action, or Lambda custom | Request and response |
| HTTP_PROXY | HTTP endpoint | None |
| HTTP | HTTP endpoint | Request and response |
Exam cues
- If the question says call Lambda with the least configuration, think Lambda proxy integrationAn integration that forwards request information to a backend under a defined input and output contract..
- If the question says reject bad input before it reaches the backend, think request validation.
- If a browser fails an HTTP API preflight request, configure CORS so API Gateway answers OPTIONS requests automatically.
Remember
- Integration timeout: 50 ms to 29 seconds; raise it only for Regional or private APIs.
- A Lambda proxy response in the wrong format returns 502 Bad Gateway.
Trap: Regional and private APIs can request a higher integration timeout quotaA target request allowance over a time interval or another documented service limit., but edge-optimized APIs cannot.
Da documentação da AWS (7)
- REST API integration types are AWS (an AWS service action with mapped request and response), AWS_PROXY (Lambda proxy), HTTP (custom HTTP with mappings), HTTP_PROXY and MOCK.
- With Lambda proxy integration (AWS_PROXY) you don't configure the integration request or response; API Gateway passes the client request to the function, and AWS recommends it for calling Lambda.
- Lambda custom and HTTP custom integrations need mapping templates for the integration request and response, but let you reuse those mappings across backends with similar formats.
- REST API request validation checks a request before the integration request; on failure API Gateway returns 400 to the caller and logs the result in CloudWatch Logs, which saves backend calls.
- The integration timeout is 50 milliseconds to 29 seconds for every integration type; Regional and private APIs can request a higher quota, edge-optimized APIs can't.
- When CORS is configured on an HTTP API, API Gateway answers preflight OPTIONS requests automatically, even without an OPTIONS route.
- If a Lambda proxy integration returns output in a format other than the expected statusCode, headers and body structure, API Gateway returns 502 Bad Gateway.
Operational settings and diagnostics
API Gateway offers settings and diagnostics for operating deployed APIs, from stageA named reference to a deployed API configuration that clients can invoke. configuration and caching to integrationThe configuration that connects an API method to a backend endpoint. troubleshooting and client SDKGenerated client code for calling a specific REST API stage in a supported language. generation.
How it works
- For a REST API, redeploy changes to resources, methodsAn HTTP operation on an API resource that defines how a client accesses it., integrations, authorizersA component that evaluates caller credentials or tokens to allow or deny API access. or models. Changes to stage settings and usage plansA set of deployed API stages and request targets associated with client API keys. do not need redeployment.
- Stage variables can select a backend endpoint within the configured integration type. When a variable supplies a Lambda function name, configure invoke permission manually.
- Configure REST API caching for methods and choose a time to live (TTLThe period in seconds for which an API response can remain cached.). A client can refresh an entry with
Cache-Control: max-age=0; when authorizationThe decision about whether an identity may perform a requested action. is required, it needsexecute-api:InvalidateCache. Resizing replaces the cache and deletes its data. - Use a mapping templateA VTL script that transforms an integration request or response payload. in Velocity Template LanguageThe scripting language used by API Gateway mapping templates to transform payload data. (VTL) to transform a REST API integration request or response. A MOCK integration returns a response without calling a backend. Mapping templates | Integration types
- Compare
Latency, which includes the backend response time, withIntegrationLatency, which measures that backend time. With caching on, use theAveragestatistic ofCacheHitCountandCacheMissCountfor hit and miss rates. - Import an OpenAPIA definition-file format API Gateway can import or export to describe a REST API. definition to create or update a REST API, or export the API as a definition. After deploying to a stage, use
GetSdkto generate a client software development kit (SDK) for that API and stage. OpenAPI import and export | GetSdk
Exam cues
- If the question says a stage variableA key-value configuration setting used by an API stage and its integrations. selects a Lambda function but invocation fails, check the target’s invoke permission, because it must be configured manually.
- If the question says a backend needs a different request body, think an integration request mapping template, because it transforms the payloadThe request or response body processed by an API integration. before the backend is called.
- If the question says a frontend needs responses before the backend exists, think MOCK integration, because API Gateway answers without a backend.
- If the question says overall latency is high but integration latencyThe time from API Gateway forwarding a request to receiving the backend response. is low, compare the two metrics, because overall latency includes more than the backend response time.
- If the question says a Lambda proxy integrationAn integration that forwards request information to a backend under a defined input and output contract. returns 502, check the function response format, because an incorrectly formatted response causes that error.
- If the question says automate SDK generation for a stage, think
GetSdk, because it generates an SDK for the specified REST API and stage.
Remember
- REST API cache TTL defaults to 300 seconds, has a maximum of 3600 seconds, and zero disables caching. Default method caching covers GET; other methods need an override.
- Cross-account cache invalidationRefreshing a matching cache entry by fetching its response from the backend. is unsupported.
- An HTTP API
$defaultstage uses the base API URL without a stage name in the path. - A REST API defaults to 10 stages per API, an adjustable quotaA target request allowance over a time interval or another documented service limit.. The limit of 100 stage variables per stage cannot be increased.
- OpenAPI 2.0 and 3.0 definitions can be imported.
Trap: A stage variable can change the backend endpoint, but it cannot switch an HTTP proxy integration to a Lambda proxy integration.
Da documentação da AWS (19)
- When a Lambda function name is supplied through a stage variable, its invoke permission must be configured manually.
- REST API stage configuration updates do not require redeployment.
- REST API usage plan configuration updates do not require redeployment.
- REST API resource, method, integration, authorizer and model updates require redeployment.
- Stage variables can change the backend endpoint but cannot switch the integration type between HTTP proxy and Lambda proxy.
- API Gateway GetSdk generates a client SDK for a REST API and a stage.
- REST API cache TTL defaults to 300 seconds, has a maximum of 3600 seconds, and zero disables caching.
- Default method-level caching applies to GET methods; other methods require a method override.
- Changing REST API cache capacity replaces the cache instance and deletes its existing cached data.
- A client can refresh a REST API cache entry with Cache-Control max-age=0; if authorization is required, the client needs execute-api:InvalidateCache. Cross-account invalidation is unsupported.
- An HTTP API $default stage is served from the base API URL without a stage name in the path.
- REST APIs have a default quota of 10 stages per API, which can be increased, and a non-increasable limit of 100 stage variables per stage.
- A REST API mapping template, written in VTL, transforms the integration request body before API Gateway calls the backend, or the integration response before it reaches the client. Without a template for the Content-Type, the body passes through unchanged.
- API Gateway generates a client SDK for a REST API after it is deployed to a stage, in Java, JavaScript, Java for Android, Objective-C or Swift for iOS, and Ruby; the GetSdk API returns it for automation.
- A MOCK integration returns a response from API Gateway without calling a backend, which helps test the integration setup without backend charges and lets teams work in parallel.
- The Latency metric covers the time from receiving a client request to returning the response, including IntegrationLatency, which is only the time the backend takes to respond.
- With API caching on, CacheHitCount counts requests served from the cache and CacheMissCount counts requests served by the backend; their Average statistic gives the hit and miss rates.
- API Gateway can create or update a REST API by importing an OpenAPI 2.0 or 3.0 definition file, and can export an API as an OpenAPI definition.
- With a Lambda proxy integration, a function response that is not in the required format makes API Gateway return 502 Bad Gateway.
Flashcards
Nada para revisar aqui agora. Escolha outros tópicos ou outro filtro.
·
Todos os 51 flashcards em lista
A team needs a managed front door for a REST API backed by Lambda functions. Which service fits?
Amazon API Gateway.
Can Amazon API Gateway send requests straight to Amazon Kinesis without a Lambda function?
Yes. A REST API can use an AWS service integration as a Kinesis proxy.
When does a changed API Gateway REST API integration take effect for callers of an existing stage?
After creating a deployment containing the change and associating it with the stage. Stage settings themselves can be updated without redeploying the API.
An API Gateway REST API must call different Lambda aliases for test and production. How can the stages select their backends?
Use a stage variable in the integration URI for the Lambda alias. Configure invoke permission manually for each selected target; the function must be in the API's account.
An API Gateway REST API receives repeated requests and the team wants fewer calls to its backend. Which stage feature can help?
Provision a stage cache and enable method caching. API Gateway can serve cached responses instead of calling the endpoint.
A newly deployed API Gateway REST API breaks production. How can the team restore the prior API snapshot?
Change the stage's active deployment to an earlier deployment.
An API Gateway REST API serves the wrong cached response for requests with different query values. What should the team configure?
Include the relevant query parameter in the cache key so different values are cached separately.
An API Gateway REST API stage has CloudWatch logging enabled but cannot write logs. Which account setting should the team check?
Configure an IAM role on the API Gateway account that permits API Gateway to write to CloudWatch Logs.
A CloudFormation stack creates an API Gateway REST API, methods and a deployment together but deploys before the methods exist. How should the template be fixed?
Add a DependsOn dependency from the deployment to the methods.
A team wants a managed front door for a REST API whose backend is AWS Lambda. Which service fits?
Amazon API Gateway.
How does an API Gateway REST API canary release route requests?
Stage canarySettings selects a canary deployment and a percentTraffic from 0.0 to 100.0. Requests are split randomly between the canary and base on the same stage.
A team wants a new API Gateway REST API release to use different backend settings for a small share of traffic. Which feature fits?
Use a canary release with stageVariableOverrides and a small percentTraffic. The base stage keeps its settings for the remaining requests.
An API Gateway REST API canary has passed testing. What does promotion change, and does it disable the canary?
Promotion copies the deployment ID and stage variables to the base stage and sets canary traffic to 0.0%. Remove canary settings separately to disable it.
Will enabling useStageCache alone activate caching for an API Gateway canary release?
No. The stage cache must also be enabled. Different deployments cache separately; the same deployment shares a cache key for equivalent requests.
Where can a team distinguish API Gateway canary execution logs from base-stage execution logs?
In the canary-specific execution log group, whose name ends in /Canary, when logging is enabled.
Which API Gateway features authenticate or authorize callers, and what do API keys do?
REST APIs support IAM signed requests, Lambda authorizers and Cognito user pool authorizers. HTTP APIs also support JWT authorizers. API keys identify usage-plan clients; they do not authenticate or authorize callers.
An AWS workload must invoke an API Gateway REST API using its IAM identity. What should the method and caller use?
Set the method authorization to AWS_IAM, grant execute-api:Invoke and sign requests using a supported AWS signature version.
A team protects an API Gateway REST API only with API keys and wants strong caller identity checks. What should it add?
An IAM, Lambda or Cognito authorizer suited to the clients. API keys serve usage plans and do not establish caller identity.
An API Gateway HTTP API accepts tokens from an identity provider and requires route permissions. Which control fits?
A JWT authorizer with the expected issuer and audience, plus route authorization scopes. The token must contain at least one configured route scope.
A team needs per-client request throttling for an API Gateway REST API. What should it use, and is the limit guaranteed?
Use an API key and usage plan with a throttling target. The target is best effort and can be exceeded.
A REST API serves mobile users worldwide from one Region. Which API Gateway endpoint type reduces their latency with no extra setup?
Edge-optimized (the default for REST APIs): requests enter at the nearest CloudFront point of presence.
An internal API must be callable only from inside a VPC, never from the internet. Which API Gateway endpoint type fits?
A private API, reached through an interface VPC endpoint.
An API deployed in two Regions must send each user to the closest Region under one custom domain. Which endpoint type and DNS feature fit?
Regional endpoints in each Region with the same custom domain, and Route 53 latency-based routing.
Clients of an API Gateway API start getting HTTP 429 during a traffic spike. What does that mean and what should clients do?
Throttling: requests exceeded the rate or burst limit.
Retry with exponential backoff; raise limits or add caching if the load is expected.
What is the default API Gateway request rate quota per account and Region?
10,000 requests per second with a burst of 5,000, shared by all APIs in the account and Region (increase on request).
One noisy API in an account consumes all of the Region's API Gateway throughput and starves other APIs. What limits it?
Set stage or method throttling (or usage plan limits per client) on that API, below the account-level quota.
Which API Gateway API type keeps a stateful, two-way connection between client and server?
A WebSocket API. REST and HTTP APIs are stateless request-response APIs.
A read-heavy REST API behind Lambda and Aurora serves data that changes rarely. What cuts backend load with the least change?
Turn on API Gateway stage caching. Responses are served from the cache for the TTL, which defaults to 300 seconds and goes up to 3,600 seconds.
A mobile app needs a serverless GraphQL API that reads and writes several DynamoDB tables. Which service fits better than API Gateway?
AWS AppSync, a managed GraphQL service; pipeline resolvers can combine operations on several tables for one field.
Which REST API integration type should you use to call a Lambda function with the least setup?
Lambda proxy integration (AWS_PROXY). API Gateway passes the whole request to the function, with no integration request or response mappings to configure.
A REST API backend keeps receiving malformed requests. How can API Gateway stop them before they reach the integration?
Turn on request validation for the method. Invalid requests get a 400 response and never reach the backend.
A Lambda function behind a Regional REST API needs 45 seconds. Does the default integration timeout allow it?
No. The default maximum is 29 seconds. A Regional or private API can request a higher integration timeout quota; an edge-optimized API can't, so long jobs usually move to an asynchronous pattern.
A browser app on another origin calls an API Gateway HTTP API and fails on the preflight request. What fixes it?
Configure CORS on the HTTP API. API Gateway then answers preflight OPTIONS requests automatically and adds the CORS headers.
An Amazon API Gateway REST API with a Lambda proxy integration returns 502 Bad Gateway although the function runs without error. What is a likely cause?
The function's response is not in the proxy format (statusCode, headers, body), so API Gateway rejects it.
An API Gateway REST API stage uses a variable for its Lambda target and receives an invocation permission error. What should the team check?
The selected Lambda target's permission for API Gateway to invoke it. Stage-variable targets require manual permission configuration.
Must an API Gateway REST API be redeployed after changing only its stage variables or usage plan?
No. Stage and usage plan configuration changes do not require redeployment. Resource and integration updates do.
Can an API Gateway stage variable switch a method from an HTTP proxy integration in test to a Lambda proxy integration in production?
No. It can select backend values within the configured integration type, but cannot change the integration type.
A team needs a generated client SDK for a specific API Gateway REST API stage. Which operation should it use?
GetSdk generates a client SDK for the REST API and stage.
What are the default and maximum TTL values for an API Gateway REST API cache?
The default is 300 seconds and the maximum is 3600 seconds. Zero disables caching.
A team enables default method-level caching for an API Gateway REST API stage. Are POST responses cached automatically?
No. Default method-level caching applies to GET methods; use a method override for POST.
What happens to cached responses when an API Gateway REST API stage cache is resized?
The cache instance is replaced and existing cached data is deleted.
How can an authorized client refresh one API Gateway REST API cache entry?
Send Cache-Control max-age=0. When authorization is required, the client needs execute-api:InvalidateCache. Cross-account invalidation is unsupported.
Which API Gateway HTTP API stage is served from the base API URL without a stage path?
The $default stage.
What are the API Gateway REST API quotas for stages per API and stage variables per stage?
The default is 10 stages per API and can be increased. The limit is 100 variables per stage and cannot be increased.
A backend behind an API Gateway REST API expects request bodies in a different JSON shape than clients send, and the backend cannot change. What in API Gateway can reshape the body?
A mapping template on the integration request. It rewrites the body with VTL before API Gateway calls the backend; without a template for that Content-Type, the body passes through unchanged.
Engineers download client SDKs for a REST API by hand after each stage update and upload them to S3. How can this be automated?
An EventBridge rule on the stage update API call, recorded by CloudTrail, invokes a Lambda function that calls API Gateway GetSdk for the stage and writes the SDK to S3.
A frontend team needs a working API endpoint that returns fixed responses before the backend exists. Which integration type fits?
A MOCK integration, which answers from API Gateway without calling any backend.
An API's Latency metric is high, but IntegrationLatency is low. Where is the time going?
In API Gateway itself rather than the backend, since Latency includes IntegrationLatency plus API Gateway overhead.
How do you measure whether an API Gateway cache is effective?
Watch CacheHitCount and CacheMissCount. Their Average statistic gives the cache hit and miss rates.
A team keeps its REST API definition in an OpenAPI file in Git. How does it create the API in API Gateway from that file?
Import the OpenAPI 2.0 or 3.0 definition into API Gateway, which builds or updates the REST API from it.
A REST API with Lambda proxy integration returns 502 Bad Gateway although the function runs without errors. What is the likely cause?
The function returns a response not in the proxy integration format (statusCode, headers, body). API Gateway answers 502 when it cannot use the output.