API Gateway Flashcards

1
Q

What are the three main API Gateway Endpoint Types

A

Edge Optimized (default)

  • Requests are routed through the CloudFront Edge locations
  • API Gateway still only lives in one region

Regional

  • For clients within the same region
  • Could manually combine with CloudFront

Private

  • Can only be accessed from you VPC using an interface VPC endpoint (ENI)
  • Use resource polict to fedine access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an API deployment?

A
  • A point-in-time snapshot of your API Gateway API.
  • To be available for clients to use, the deployment must be associated with one or more API stages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an API stage?

A

A logical reference to a lifecycle state of your API (for example, ‘dev’, ‘prod’, ‘beta’, ‘v2’). API stages are identified by API ID and stage name.

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

What are Canary deployments on API Gateway?

A
  • It the API Gateway verson of a blue/green deployment with AWS lambda.
  • Choose the % of traffic the canary channel recieves
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why use an API cache? When would you not use one?

A
  • Caching reduces the # of calls made to the backend.
  • They are defined per stage
  • Can be encrypted
  • They are expensive so may not make sense in the dev environment.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How are API Gateway Caches invalidated?

A
  • Clients can invalidate the cache with header: Cache-Control: max-age=0 (requires proper IAM authorization)
  • If you do not impose an InvalidateCache policy (or choose the Require authorization check box in the console), any client can invalidate the API cache = bad.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the default TTL in the API Gateway Cache?

A

300 seconds (5 mintues)

min = 0s, max = 3600s

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

What are the 4 Integration Types for API Gateways?

A
  • MOCK
  • HTTP
  • AWS_PROXY (Lambda Proxy)
  • HTTP_PROXY
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe API Gateway Integration Type MOCK

A
  • API Gateway returns a response without sending the request to the backend.
  • Good for development
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe API Gateway Integration Type HTTP / AWS (Lambda and AWS Services)

A
  • You must configure both the integration request and integration response
  • Setup data mapping using mapping templates for the request and response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe API Gateway AWS_PROXY Integration Type

A
  • Incoming request from the client is the input to Lambda
  • The function is responsible for the logic of request / response
  • No mapping template, headers, query string parameters etc. are passed as arguments.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe API Gateway HTTP_PROXY Integration Type

A
  • No Mapping template
  • The HTTP request is passed to the backend
  • The HTTP repsonse from the backend is forwarded by API Gateway
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are API Gateway Mapping Templates?

A
  • Mapping templates are data transformation tools that can be used to modify request / responses.
    • Rename / Modify query string params
    • Modify body content
    • Add Headers
    • Uses Velocity Template Language (VTL): for loop, if etc …
    • Filter output results (remove unnecessary data)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In API Gateway, what is an integration?

A
  • Integration connects a route to backend resources.
  • Each API type has its own integration types.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the 4 API Gateway types? Summarize Each.

A

HTTP API

  • Low latency and cost effective. Integrates in with OAuth and OIDC.
  • Works with Lambda and HTTP backends
  • No useage plan

REST API

  • Have more control - main use of API Gateway
  • Works with Lambda, HTTP, AWS Services

Web Socket API

  • Best used for real-time data apps like chat applications or dashboards.Think 2-way applications.
  • Requests get routed to a specific routing expression.
  • Works with Lambda, HTTP, and AWS Sweater

REST API (Private)

  • Accessible only from VPC
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the correct order of steps to configure a usage plan/api keys in API Gateway?

A
  1. Create one or more APIs, configure methods to require an API key, and deploy the API to stages.
  2. Generate or import API keys to distribute to application developers (your customers) who will be using your API.
  3. Create the usage plan with the desired throttle and quota limits.
  4. Associate API stages and API keys with the useage plan.
  5. Callers of the API must supply an assigned API key in the x-api-key header in requests to the API.
17
Q

API Gateway - What is a usage plan?

A
  • Usage plans help you meter API usage.
  • You can enforce throttling and quota limits on each API key.
18
Q

API Gateway - what are throttling limits?

A

Throttling limits define the maximum number of requests per second available to each key.

19
Q

API Gateway - What are quota limits?

A

Quota limits define the number of requests each API key is allowed to make over a period of time.

20
Q

What is the maximum amount of time for a request in API Gateway?

A

29 seconds.

If the request lasts longer then 29 seconds then it will return a timeout error.

21
Q

What 2 API methods can hep you evaluate the efficency of your API Gateway cache?

A
  • CacheHitCount
  • CacheMissCount
22
Q

What metric allows you to monitor the time it takes for an API Gateway to relay a request to the backend and how long it takes to get a response from the backend?

A

IntegrationLatency

23
Q

What API metric allows you to measure the time between when API Gateway recieves a request from a client and how long it takes the client to recieve a response for the API Gateway?

A

Latency.

This includes the IntegrationLatencyTime as well as the overhead of the API Gateway itself.

24
Q

What is the default throttling measure across all of you API Gateways?

A

10,000 requests per second

This is a soft limit that can be increased on request

25
Q

What error code will you recieve if you have reached throttling limits in API Gateway?

A

429

26
Q
A
27
Q

What are the 3 main ways you can secure you API Gateway?

A

IAM / Resource Policy - Best if you’re already managing users/groups and/or need cross account access. Uses Sigv4

Custom Authorizer - for when youre uing a 3rd party like OAuth / OIDC

AWS Cognito

28
Q

What is AWS API Gateway?

A
  • Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.
  • APIs act as the front door for applications to access data, business logic, or functionality from your backend services.