API Gateway Flashcards
API Gateway – Integrations
Lambda function
HTTP
AWS SEvice
API Gateway - Endpoint Types
- Edge-Optimized (default): For global clients
- The API Gateway still lives in only one region
Regional: - For clients within the same region
- Could manually combine with CloudFront (more control over the
caching strategies and the distribution)
Private:
Can only be accessed from your VPC using an interface VPC endpoint (ENI) Use a resource policy to define access
- The API Gateway still lives in only one region
api gateway authentication through :
IAM Roles (useful for internal applications)
* Cognito (identity for external users – example mobile users)
* Custom Authorizer (your own logic)
What is a stage in AWS API Gateway?
A stage is a logical reference to a lifecycle state of your API (e.g., dev, staging, production). It allows you to deploy and manage different versions of your API independently.
API Gateway – Stage Variables
use cases
Configure HTTP endpoints your stages talk to (dev, test, prod…)
* Pass configuration parameters to AWS Lambda through mapping templates
create a stage variable to indicate the corresponding Lambda alias!!!
- Stage variables are passed to the ”…” object in AWS Lambda
context
how to enable cannary deployment with Lambda and api gateway?
use lambda versions and api stages and stage variables
API Gateway - Integration Types
MOCK
* Integration Type HTTP / AWS (Lambda & AWS Services)
* Integration Type AWS_PROXY (Lambda Proxy):
HTTP_PROXY
What is the purpose of the AWS Service Integration type in API Gateway?
It allows you to integrate API Gateway with other AWS services like Lambda, S3, or DynamoDB by using service-specific endpoints, enabling you to invoke these services directly from your A
What is the difference between HTTP and HTTP_PROXY integrations?
HTTP: Requires request/response mapping, giving more control over the data transformation.
HTTP_PROXY: Directly passes the client request to the backend without transformations, simplifying integration but with less control.
how to integrate JSON to XML with SOAP with api gateway
USE TEMPLATE MAPPIG :
Extract data from the request: either path, payload or header
* Build SOAP message based on request data (mapping template)
* Call SOAP service and receive XML response
* Transform XML response to desired format (like JSON), and respond to the user
use cases for Mapping Templates (AWS & HTTP Integration)
- Rename / Modify query string parameters
- Modify body content
- Add headers
- Filter output results (remove unnecessary data)
- Content-Type can be set to application/json or application/xml
how to reduce unecessary invalid api calls to backend ?
use api gateway api validation
When the validation fails, API Gateway immediately fails the request
* Returns a 400-error response to the caller
Api gateway cache properties
- Default TTL (time to live) is 300 seconds
(min: 0s, max: 3600s) - Caches are defined per stage !!!
- Possible to override cache settings per method
- Cache encryption option
- Cache capacity between 0.5GB to 237GB
How to invalidate API Gateway Cache
- Clients can invalidate the
cache with header: Cache- Control: max-age=0 (with
proper IAM authorization)