API Gateway Flashcards
What is API Gateway
Fully managed service
Allows you to publish, maintain, monitor, and secure your
RESTful APIs.
Serves as the entry point for your back-end services that are powered by :
* AWS Lambda
* Amazon EC2
* Amazon ECS
* AWS Elastic Beanstalk
* or any web application.
What are the sections of the data from to and from the client through API gateway?
- Method Request
- Integration Request
- Integration Response
- Method Response
What does the Method Request section do?
- Where client requests are validated
- Setup authorization type: AWS_IAM, NONE, Lambda Authorizer, Cognito Authorizer
- Enable usage of API keys
- Setup Request body validator using a Lambda function
- You can declare any input body, query string parameters and HTTP headers that your API can accept
What does the Integration Request section do?
Contains settings about :
* how API Gateway communicates with the backend of your choosing (Lambda function, HTTP endpoint, Mock, AWS Service, VPC Link)
* the Integration type (Proxy or non-proxy) that API Gateway uses
* Mapping templates for non-proxy integration.
What is the Integration Response
Only applies to non-proxy integration
Intercepts the result returned from the backend before it’s returned to the client
At least one integration response is required. The default is Passthrough (return as-is)
Transform into another format (base64 or text)
Similar to integration request, you can transfor the response data before it’s returned to the client
What is the method response?
Where you can define which HTTP headers the method can return
What are mapping templates?
- They allow you to MODEL the structure of the request data that gets forwarded to the backend
- You can also transform backend response data before it’s returned to the client
What are the API types that API gateway supports?
REST APIs, HTTP APIs, Websocket APIs
What are REST APIs?
- The API you use for standard use cases
- More expensive than HTTP
- Allows for more control and flexibility
- Allows you to configure Caching, API keys, usage plans
What are HTTP APIs
- Designed for simple use cases
- Cheaper than REST APIs
- Lacks other API Gateway features
What are websocket APIs?
- For real-time applications :
- Chat applications
- Trading applications
What is the difference between proxy and non-proxy integrations?
Proxy
- requests are transmitted as-is between client and backend, including any headers or query parameters.
- For responses, your backend is responsible for returning the responses status code, headers and payload to the client.
Non-Proxy
* API Gateway has control over data formatting to and from the backend
* Instead of passing the entire request data, you can use mapping templates to filter at the Integration Request level
What are stage variables?
- Key-pairs that your API can access at run time
- Allow you to perform Canary releases
- In youre stage you can use stage variables to dynamically point to different endpoints (like lambda aliases)
- This can be configured in the canary settings of your stage
What is a canary release?
- Allows you to use the same API Gateway state and route a % of traffic to different endpoints.
- e.g in the prod stage you can route 10% of traffic to a new lambda alias using stage variables
What are mapping templates?
They can be used to transform requests and responses