API Gateway Flashcards

1
Q

API Gateway – Integrations

A

Lambda function
HTTP
AWS SEvice

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

API Gateway - Endpoint Types

A
  • Edge-Optimized (default): For global clients
    • The API Gateway still lives in only one region
      Regional:
    • For clients within the same region
    • Could manually combine with CloudFront (more control over the
      caching strategies and the distribution)
      Private:
      Can only be accessed from your VPC using an interface VPC endpoint (ENI) Use a resource policy to define access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

api gateway authentication through :

A

IAM Roles (useful for internal applications)
* Cognito (identity for external users – example mobile users)
* Custom Authorizer (your own logic)

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

What is a stage in AWS API Gateway?

A

A stage is a logical reference to a lifecycle state of your API (e.g., dev, staging, production). It allows you to deploy and manage different versions of your API independently.

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

API Gateway – Stage Variables
use cases

A

Configure HTTP endpoints your stages talk to (dev, test, prod…)
* Pass configuration parameters to AWS Lambda through mapping templates
create a stage variable to indicate the corresponding Lambda alias!!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
  • Stage variables are passed to the ”…” object in AWS Lambda
A

context

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

how to enable cannary deployment with Lambda and api gateway?

A

use lambda versions and api stages and stage variables

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

API Gateway - Integration Types

A

MOCK
* Integration Type HTTP / AWS (Lambda & AWS Services)
* Integration Type AWS_PROXY (Lambda Proxy):
HTTP_PROXY

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

What is the purpose of the AWS Service Integration type in API Gateway?

A

It allows you to integrate API Gateway with other AWS services like Lambda, S3, or DynamoDB by using service-specific endpoints, enabling you to invoke these services directly from your A

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

What is the difference between HTTP and HTTP_PROXY integrations?

A

HTTP: Requires request/response mapping, giving more control over the data transformation.
HTTP_PROXY: Directly passes the client request to the backend without transformations, simplifying integration but with less control.

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

how to integrate JSON to XML with SOAP with api gateway

A

USE TEMPLATE MAPPIG :
Extract data from the request: either path, payload or header
* Build SOAP message based on request data (mapping template)
* Call SOAP service and receive XML response
* Transform XML response to desired format (like JSON), and respond to the user

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

use cases for Mapping Templates (AWS & HTTP Integration)

A
  • Rename / Modify query string parameters
  • Modify body content
  • Add headers
  • Filter output results (remove unnecessary data)
  • Content-Type can be set to application/json or application/xml
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how to reduce unecessary invalid api calls to backend ?

A

use api gateway api validation
When the validation fails, API Gateway immediately fails the request
* Returns a 400-error response to the caller

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

Api gateway cache properties

A
  • Default TTL (time to live) is 300 seconds
    (min: 0s, max: 3600s)
  • Caches are defined per stage !!!
  • Possible to override cache settings per method
  • Cache encryption option
  • Cache capacity between 0.5GB to 237GB
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to invalidate API Gateway Cache

A
  • Clients can invalidate the
    cache with header: Cache- Control: max-age=0 (with
    proper IAM authorization)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are possible solutions to make an API available as an offering ($) to your customers

A

Usage Plan:
* who can access one or more deployed API stages and methods
* how much and how fast they can access them
* uses API keys to identify API clients and meter access
* configure throttling limits and quota limits that are enforced on individual client

17
Q

what information contains * CloudWatch Logs for api gateway?

A

Log contains information about request/response bod

18
Q

API Gateway – CloudWatch Metrics

A
  • Metrics are by stage, Possibility to enable detailed metrics
  • CacheHitCount & CacheMissCount: efficiency of the cache
  • Count: The total number API requests in a given period.
  • IntegrationLatency: The time between when API Gateway relays a
    request to the backend and when it receives a response from the
    backend.
  • Latency: The time between when API Gateway receives a request from
    a client and when it returns a response to the client. The latency
    includes the integration latency and other API Gateway overhead.
  • 4XXError (client-side) & 5XXError (server-side)
19
Q

API Gateway requests time out after … second maximum

A

29

20
Q

can one api gateway throtlie other apis ?

A

Just like Lambda Concurrency, one API that is overloaded, if not limited, can cause the other APIs to be throttled

21
Q

how to provider acess within AWS for api

A

IAM Permissions
Create an IAM policy authorization and attach to User / Role
* Authentication = IAM | Authorization = IAM Policy

22
Q

what Allow for Cross Account Access (combined with
IAM Security) for the aPI

A

API Gateway
– Resource Policies

23
Q

Q: What are the four primary authentication methods supported by AWS API Gateway?

A

IAM Authorization
Lambda Authorizers
Amazon Cognito User Pools
API Key Authentication

24
Q

Q: How does API Gateway validate requests using IAM Authorization?

A

API Gateway validates the AWS Signature Version 4 in the request, ensuring the caller has proper permissions.

25
Q

Q: What is an Amazon Cognito User Pool?

A

A: An Amazon Cognito User Pool is a managed service for user authentication, providing user sign-up, sign-in, and token-based authentication for API Gateway.

26
Q

Q: How does API Gateway integrate with Amazon Cognito User Pools?

A

: API Gateway validates tokens issued by Amazon Cognito for authenticated users before granting API access.

27
Q

Q: What is the purpose of an API Gateway Usage Plan?

A

A usage plan allows API Gateway to associate API keys with limits and throttling rules, controlling API acce

28
Q

Q: What is a common use case for Lambda Authorizers?

A

: Validating JWT tokens issued by third-party identity providers or implementing custom authentication rules.

29
Q

API Gateway – WebSocket API app use case

A

Two-way interactive communication between a user’s browser and a server
WebSocket APIs are often used in real- time applications such as chat
applications, collaboration platforms,
multiplayer games, and financial trading
platforms.

Works with AWS Services (Lambda,
DynamoDB) or HTTP endpoints

30
Q

How does routing work in AWS API Gateway WebSocket APIs?

A

Answer:

Messages are routed using route keys.
Special routes:
* $connect (when a client connects)
* $disconnect (when a client disconnects)
* $default (when no specific route matches)
Custom route keys match message content.
Each route is linked to a backend (e.g., Lambda) to handle the message.

31
Q

To make a Serverless API, you should integrate API Gateway with ………………….

A

aws lambda

32
Q

API Gateway Caching is defined per ………………… with the default TTL …………………

A

Stage, 300 seconds

33
Q

How can clients invalidate the cache of an API from the client-side?

A

Pass the http header Cache-control: max-age=0

34
Q

Which CloudWatch metrics helps you analyze the timeout issues between your API Gateway and a Lambda function?

A

Integration LAtency

35
Q
A