23. API Gateway **IMPORTANT** Flashcards

1
Q

What are the API Gateway endpoint types?

A
  1. Edge-Optimized (default)
  2. Regional
  3. Private
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You made changes to the API Gateway but they’re not showing up – why?

A

You need to make a “deployment” for API Gateway changes to be in effect

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

When would you use a Stage variable in API Gateway?

A
  1. to configure your HTTP endpoints your stages talk to (dev, test, prod)
  2. to pass configuration parameters to AWS Lambda through mapping templates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Stage variables are passed to which object in AWS Lambda?

A

Stage variables are passed to the “context” object in AWS Lambda

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

If you wanted to change the percentage of traffic sent to a stage, what would you use?

A

Canary deployment

Used in blue/green deployments

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

What are the API Gateway Integration Types?

A
  1. MOCK
  2. HTTP / AWS (Lambda & AWS Services)
  3. AWS_PROXY (Lambda Proxy)
  4. HTTP_PROXY
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the MOCK Integration Type?

A

API Gateway returns a response without sending the request to the backend

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

How do you configure the HTTP/AWS Integration Type?

A
  1. you must configure both the integration request and the integration response
  2. 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
9
Q

How do you configure the AWS_PROXY Integration Type?

A

no mapping template

incoming request from the client is the input to Lambda

headers, query string parameters are passed as arguments

the function is responsible for the logic of request / response

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

How do you configure the HTTP_PROXY Integration Type?

A

no mapping template

the HTTP request is passed to the backend
the HTTP response from the backend is forwarded by API gateway

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

What do you use to modify request / responses for AWS & HTTP integration?

A

Mapping Templates

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

What is the default cache TTL?

A

300 seconds

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

What is the max cache TTL?

A

1 hour (3600 seconds)

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

What header can clients use to invalidate the cache (with proper IAM authorization)?

A

Cache-Control: max-age=0

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

What should you use to make an API available as an offering ($) for your customers?

A

a Usage Plan

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

How does a Usage Plan identify API clients and meter access?

A

API Keys

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

What is an API Key?

A

an alphanumeric string value to distribute to customers that can be used with a usage plan to control access

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

In a Usage Plan, how are throttling limits applied?

A

to the API Keys / the individual

19
Q

What is the overall number of maximum requests?

A

Quota limit

20
Q

What are the steps to configure a usage plan?

A
  1. Create API(s), configure methods to require an API key, and deploy the API(s) 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 usage plan
21
Q

Callers of the API must supply an assigned API key in which header in requests to the API?

A

x-api-key

22
Q

What CloudWatch metrics provide information on the efficiency of the cache?

A

CacheHitCount and CacheMissCount

23
Q

What CloudWatch metric provides information on the total number of API requests in a given period?

A

Count

24
Q

What CloudWatch metric provides information on the time between when API Gateway relays a request to the backend and when it receives a response from the backend?

A

IntegrationLatency

25
Q

What CloudWatch metrics provide information on the time between when API Gateway receives a request from a client and when it returns a response from the client?

A

Latency

Latency will always be higher than IntegrationLatency bc Latency includes IntegrationLatency and other API Gateway overhead

26
Q

What HTTP error message do you receive if requests are being throttled?

A

HTTP 429 Too Many Requests

27
Q

How do you specify who can access one or more deployed API stages and methods (and also how much and how fast they can access them)?

A

API Gateway Usage Plans and API keys

28
Q

What is the HTTP Error indicating Gateway Timeout?

A

HTTP 504

HTTP 504 is ‘Gateway timeout’ error. Several reasons for this error, to quote a few: The load balancer failed to establish a connection to the target before the connection timeout expired, The load balancer established a connection to the target but the target did not respond before the idle timeout period elapsed.

29
Q

What is the HTTP Error indicating a web ACL is blocking requests to your ALB?

A

HTTP 403 ‘Forbidden’

30
Q

Are 4XXError errors client or server side?

A

4XXError is client-side

31
Q

Are 5XXError errors client or server side?

A

5XXError is server-side

32
Q

API Gateway throttles requests at what rps across all API?

A

API Gateway throttles requests at 10,000 rps across all API

33
Q

What must be enabled when you receive API calls from another domain?

A

CORS

34
Q

The OPTIONS pre-flight request must contain which headers?

A
  1. Access-Control-Allow-Methods
  2. Access-Control-Allow-Headers
  3. Access-Control-Allow-Origin
35
Q

Can CORS be enabled through the console?

A

Yes

36
Q

How should you provide IAM permissions to API Gateway?

A

Create an IAM policy authorization and attach to a User / Role

37
Q

What allows for Cross Account Access to API Gateway?

A

Resource Policies + IAM Security

38
Q

What are the 3 ways to handle API Gateway user security?

A
  1. IAM (+ resource policy for cross account)
  2. Custom Authorizer
  3. Cognito User Pool
39
Q

When should you use IAM for API Gateway security?

A

IAM is great for users / roles already within your AWS account (+ resource policy for cross account)

40
Q

When should you use a Custom Authorizer for API Gateway security?

A

When you need to handle 3rd party tokens.

Also known as Lambda Authorizer. Authorizatoin is done in the Lambda function

41
Q

When should you use Cognito User Pool for API Gateway security?

A

When you want to manage your own user pool that can be backed by Facebook, Google login, etc

Must implement authorization in the backen

42
Q

What type of API is often used in real-time applications such as chat apps, multiplayer games, and financial trading platforms?

A

WebSocket API

  • enables stateful application use cases
  • allows server to push information to the client
43
Q

What can be used to grant API access to one AWS account to users in a different AWS account using Signature Version 4 (SigV4) protocols?

A

A resource policy