AWS API Gateway Flashcards
Amazon API Gateway
API Gateway is a fully managed service that makes it easy for developers to publish, maintain, monitor, and secure APIs at any scale.
API Gateway supports the following:
- Creating, deploying, and managing a REST application programming interface (API) to expose backend HTTP endpoints, AWS Lambda functions, or other AWS services.
- Creating, deploying, and managing a WebSocket API to expose AWS Lambda functions or other AWS services.
- Invoking exposed API methods through the frontend HTTP and WebSocket endpoints.

All the APIs created with Amazon API Gateway expose HTTPS endpoints only (does not support unencrypted endpoints) ? T/F
True
CloudFront is used as the public endpoint for API Gateway ? T/F
True
Permissions to invoke a method are granted using IAM roles and policies or API Gateway custom authorizers ? T/F
True
API Gateway Certificate Concepts ?
By default API Gateway assigns an internal domain that automatically uses the API Gateway certificates.
When configuring your APIs to run under a custom domain name you can provide your own certificate.
What are Amazon API Gateway core Features ?
Support for RESTful APIs and WebSocket APIs
- With API Gateway, you can create RESTful APIs using either HTTP APIs or REST APIs
Private integrations with AWS ELB & AWS Cloud Map
- With API Gateway, you can route requests to private resources in your VPC. Using HTTP APIs, you can build APIs for services behind private ALBs, private NLBs, and IP-based services registered in AWS Cloud Map, such as ECS tasks.
Metering
- Define plans that meter and restrict third-party developer access to APIs.
Security
- API Gateway provides multiple tools to authorize access to APIs and control service operation access.
Resiliency
- Manage traffic with throttling so that backend operations can withstand traffic spikes.
Operations Monitoring
- API Gateway provides a metrics dashboard to monitor calls to services.
Lifecycle Management
- Operate multiple API versions and multiple stages for each version simultaneously so that existing applications can continue to call previous versions after new API versions are published.
AWS Authorization
- Support for signature version 4 for REST APIs and WebSocket APIs, IAM access policies, and authorization with bearer tokens (e.g., JWT, SAML) using Lambda functions.
What is an Endpoint ?
An API endpoint type is a hostname for an API in API Gateway that is deployed to a specific region.
The hostname is of the form {api-id}.execute-api.{region}.amazonaws.com.
The API endpoint type can be edge-optimized, regional, or private, depending on where most of your API traffic originates from.

What is Edge-Optimized Endpoint ?
An edge-optimized API endpoint is best for geographically distributed clients. API requests are routed to the nearest CloudFront Point of Presence (POP). This is the default endpoint type for API Gateway REST APIs.
Edge-optimized APIs capitalize the names of HTTP headers (for example, Cookie).
CloudFront sorts HTTP cookies in natural order by cookie name before forwarding the request to your origin. For more information about the way CloudFront processes cookies, see Caching Content Based on Cookies.
Any custom domain name that you use for an edge-optimized API applies across all regions.
What is a Regional Endpoint ?
- A regional API endpoint is intended for clients in the same region.
- When a client running on an EC2 instance calls an API in the same region, or when an API is intended to serve a small number of clients with high demands, a regional API reduces connection overhead.
- For a regional API, any custom domain name that you use is specific to the region where the API is deployed.
- If you deploy a regional API in multiple regions, it can have the same custom domain name in all regions.
- You can use custom domains together with Amazon Route 53 to perform tasks such as latency-based routing.
- Regional API endpoints pass all header names through as-is.
What is a Private Endpoint ?
A private API endpoint is an API endpoint that can only be accessed from your Amazon Virtual Private Cloud (VPC) using an interface VPC endpoint, which is an endpoint network interface (ENI) that you create in your VPC.
Private API endpoints pass all header names through as-is.
Define API Gateway REST API ?
A collection of HTTP resources and methods that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services.
This collection can be deployed in one or more stages.
Typically, API resources are organized in a resource tree according to the application logic.
Each API resource can expose one or more API methods that have unique HTTP verbs supported by API Gateway.

What is API Gateway WebSocket API ?
A collection of WebSocket routes and route keys that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services.
The collection can be deployed in one or more stages.
API methods are invoked through frontend WebSocket connections that you can associate with a registered custom domain name.
What is Stages and Stage variables ?
A stage is a logical reference to a lifecycle state of your REST or WebSocket API (for example, ‘dev’, ‘prod’, ‘beta’, ‘v2’).
API stages are identified by API ID and stage name.

Stage variables can be used in ?
Stage variables can be used in:
- Lambda function ARN.
- HTTP endpoint.
- Parameter mapping templates.
Stage variables are passed to the “context” object in Lambda.
Stage variables are used with Lambda aliases.
You can create a stage variable to indicate the corresponding Lambda alias.
You can create canary deployments for any stage – choose the % of traffic the canary channel receives.
Use cases for stage variables ?
Use cases for stage variables ?
- Configure HTTP endpoints your stages talk to (dev, test, prod etc.).
- Pass configuration parameters to AWS Lambda through mapping templates.
What is a Mapping Template
- Mapping templates can be used to modify request / responses.
- Rename parameters.
- Modify body content.
- Add headers.
- Map JSON to XML for sending to backend or back to client.
- Uses Velocity Template Language (VTL).
- Filter output results (remove unnecessary data).
Caching principles, explain ?
You can add caching to API calls by provisioning an Amazon API Gateway cache and specifying its size in gigabytes.
Caching allows you to cache the endpoint’s response.
Caching can reduce the number of calls to the backend and improve the latency of requests to the API.
API Gateway caches responses for a specific amount of time (time to live or TTL).
The default TTL is 300 seconds (min 0, max 3600).
Caches are defined per stage.
You can encrypt caches.
The cache capacity is between 0.5GB to 237GB.
It is possible to override cache settings for specific methods.
You can flush the entire cache (invalidate it) immediately if required.
Clients can invalidate the cache with the header: Cache-Control: max-age=0 .

What are the API throttling limits ?
By default API Gateway limits the steady-state request rate to 10,000 requests per second.
The maximum concurrent requests is 5,000 requests across all APIs within an AWS account.
If you go over 10,000 requests per second or 5,000 concurrent requests you will receive a 429 Too Many Requests error response
Amazon API Gateway provides two basic types of throttling-related settings ?
Server-side throttling limits are applied across all clients. These limit settings exist to prevent your API—and your account—from being overwhelmed by too many requests.
Per-client throttling limits are applied to clients that use API keys associated with your usage policy as a client identifier.
API Gateway throttling-related settings are applied in the following order ?
- Per-client per-method throttling limits that you set for an API stage in a usage plan.
- Per-client throttling limits that you set in a usage plan.
- Default per-method limits and individual per-method limits that you set in API stage settings.
- Account-level throttling.
AWS Integration Methodology
In AWS integration, you must configure both the integration request and integration response and set up necessary data mappings from the method request to the integration request, and from the integration response to the method response.

What is AWS_PROXY Integration ?
This type of integration lets an API method be integrated with the Lambda function invocation action with a flexible, versatile, and streamlined integration setup.
This integration relies on direct interactions between the client and the integrated Lambda function.
With this type of integration, also known as the Lambda proxy integration, you do not set the integration request or the integration response.
API Gateway passes the incoming request from the client as the input to the backend Lambda function.

HTTP Integration, what is it ?
This type of integration lets an API expose HTTP endpoints in the backend.
With the HTTP integration, also known as the HTTP custom integration, you must configure both the integration request and integration response.
You must set up necessary data mappings from the method request to the integration request, and from the integration response to the method response.
What is HTTP_PROXY Integration ?
The HTTP proxy integration allows a client to access the backend HTTP endpoints with a streamlined integration setup on single API method.
You do not set the integration request or the integration response.
API Gateway passes the incoming request from the client to the HTTP endpoint and passes the outgoing response from the HTTP endpoint to the client.




