API Gateway Flashcards

1
Q

What does “deploying” your API Gateway achieve?

A

Makes the API Gateway accessible as an HTTP endpoint (an “invoke” URL)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

API Gateway Resource vs. API Gateway Method

A

Resource is an object or collection of objects represented by a URL path, like: {api-id}.execute-api-us.west2-amazon.aws.com/books

A Method is the HTTP VERB that acts on the Resource NOUN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Flavors of API Gateway Integration Requests / Responses

A

API Gateways connection to the client (Method Requests and Responses) are not subdivided

The backend connections can be to Lambda, HTTP endpoints, or AWS Services. The “Integration Request” and “Integration Response” can be Lambda (Custom or Proxy), HTTP (Custom or Proxy), or Mock (for testing purposes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Three types of API Gateway authentication methods

A

IAM Roles and Policies
Cognito User Pools
Lambda Authorizers (both token-based and request parameter-based)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Permissions / Steps to allow a user to invalidate an API Gateway cache

A
  1. Tick the “Require Authorization” box (so that not everyone can invalidate the cache)
  2. User assumes a Role that includes “Allow / execute-api: InvalidateCache” permission.
  3. User sends a request with header: CACHE-CONTROL: MAX-AGE = 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

CW Monitoring of API Execution (Latency): overall responsiveness, backend responsiveness

A

Overall: LATENCY metric. Backend: INTEGRATION LATENCY metric

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Key function / slogan of API Gateway. What does it do?

A

“Expose any AWS Service to the outside world.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Chief Value of API Gateway for each of the three backend integrations

A

Lambda: easiest way to connect a REST API to a Lambda function
HTTP: API Gateway can add rate limiting, caching, user authorization, API keys, etc. to backend URL
AWS Service: Authorization, public access, rate control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Most common meaning of a “Bad Gateway 502” error on a Lambda Proxy Integration

A

The format the Lambda function returned doesn’t match what’s needed to be passed to the client (maybe XML vs. JSON)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Purpose of API Gateway’s STAGE Variables

A

Allow you to parameterize / adjust the behavior of APIs during runtime without redeploying the APIG. Useful in any multi-environment API Gateway set up. You set the key-value stage variables in API Gateway, then reference them in mapping templates or other client-side structures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

API Request Limit and Throttling Error Code

A

10,000 requests / second or 5,000 concurrent requests
429 Too Many Requests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the API Gateway cache capacity?

A

0.5 GB - 237 GB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Steps to create an API Gateway

A
  1. Sign in to AWS Console:
    Log into the AWS Management Console and navigate to API Gateway service.
  2. Create an API:
    Choose to create a new API. AWS API Gateway offers different types of APIs, including HTTP APIs, REST APIs, and WebSocket APIs. Select the type of API you need based on your use case.
  3. Define API Routes:
    Create and define the routes (also known as resources) for your API. For example, you might define routes like /users or /products.
  4. Configure Method:
    For each route, configure the HTTP method (GET, POST, PUT, DELETE, etc.). Set up the integration type for the method (like Lambda function, HTTP endpoint, or AWS service) and link the appropriate backend.
  5. Set Up Request & Response:
    Configure request and response parameters, headers, and request/response models if necessary. Set up mapping templates if you need to modify the request or response format.
  6. Deploy API:
    To make your API accessible, you need to deploy it to a stage. A stage is a reference to a deployment of an API and is often associated with a specific environment (like prod, dev, or beta).
  7. Configure Domain (For HTTPS Endpoint):
    Purchase or use an existing custom domain and configure it in API Gateway, or use the default endpoint provided by AWS.
    Set up an SSL/TLS certificate for your custom domain. AWS Certificate Manager (ACM) can be used to request and manage certificates.
    Create a custom domain name in API Gateway and associate it with the deployed API stage. Configure the base path mapping to link your custom domain to the deployed stage of the API.
  8. DNS Configuration:
    Update your domain’s DNS records to point to the API Gateway endpoint. This might involve creating a CNAME record that points to the API Gateway domain name.
  9. Testing and Monitoring:
    Test the API using tools like curl, Postman, or through your application.
    Set up CloudWatch logging and monitoring for insight into the API’s performance and usage.
  10. Security & Authorization:
    Implement security measures such as API keys, AWS Identity and Access Management (IAM) roles and policies, or Lambda authorizers to control access to your API.
  11. Throttling & Quotas:
    Optionally set up throttling rules and usage quotas to protect your backend systems from traffic spikes.
  12. Documentation:
    Document your API, making it easier for developers to understand and integrate with your services. API Gateway supports Swagger/OpenAPI definitions for documentation.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a “Request Validation” in the API Gateway context?

A

A configuration to get API Gateway to test / validate an API request (headers / body / query string, etc.) without bothering the backend. Returns a 400 error if there is an issue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Four API Gateway error messages to know: 403 Access Denied, 429 Throttle, 502 Bad Gateway, 504

A

403 may mean filtered by WAF
429 throttle
502 Bad Gateway (often an incompatible response / output from
backend)
504 Endpoint Timeout (29s) – this is not changeable for a Lambda backend. Can be changed for HTTPS backends, up to 50 s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Three API Gateway Endpoint Types

A
  1. Edge-Optimized: requests are routed to the nearest Edge POP
  2. Regional: CloudFront not used, customers are assumed to be in a single region, so a single endpoint is fine
  3. Private: Endpoint only accessible within a VPC with an VPC endpoint
17
Q
A