Skip to content

Commit 2fa3a22

Browse files
authored
Added API Gateway notes
1 parent f92be93 commit 2fa3a22

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

CDA.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,3 +1348,57 @@ about the change
13481348

13491349
----------------------------------------------
13501350

1351+
# API Gateway
1352+
## API Gateway -- Integrations High Level
1353+
- Lambda Function
1354+
- Invoke Lambda function
1355+
- Easy way to expose REST API backed by AWS Lambda
1356+
- HTTP
1357+
- Expose HTTP endpoints in the backend
1358+
- Example: internal HTTP API on premise, Application Load Balancer...
1359+
- Why? Add rate limiting, caching, user authentications, API keys, etc...
1360+
- AWS Service
1361+
- Expose any AWS API through the API Gateway?
1362+
- Example: start an AWS Step Function workflow, post a message to SQS
1363+
- Why? Add authentication, deploy publicly, rate control...
1364+
1365+
## API Gateway - Endpoint Types
1366+
- Edge-Optimized (default): For global clients - Requests are routed through the CloudFront Edge locations (improves latency) - The API Gateway still lives in only one region
1367+
- Regional: - For clients within the same region - Could manually combine with CloudFront (more control over the caching strategies and the distribution)
1368+
- Private: - Can only be accessed from your VPC using an interface VPC endpoint (ENI) - Use a resource policy to define access
1369+
1370+
## API Gateway -- Deployment Stages
1371+
- Making changes in the API Gateway does not mean they're effective
1372+
- You need to make a "deployment" for them to be in effect
1373+
- It's a common source of confusion
1374+
- Changes are deployed to "Stages" (as many as you want)
1375+
- Use the naming you like for stages (dev, test, prod)
1376+
- Each stage has its own configuration parameters
1377+
- Stages can be rolled back as a history of deployments is kept
1378+
1379+
## API Gateway -- Stage Variables
1380+
- Stage variables are like environment variables for API Gateway
1381+
- Use them to change often changing configuration values
1382+
- They can be used in:
1383+
- Lambda function ARN
1384+
- HTTP Endpoint
1385+
- Parameter mapping templates
1386+
- Use cases:
1387+
- Configure HTTP endpoints your stages talk to (dev, test, prod...)
1388+
- Pass configuration parameters to AWS Lambda through mapping templates
1389+
- Stage variables are passed to the "context" object in AWS Lambda
1390+
1391+
## API Gateway - Integration Types
1392+
- Integration Type MOCK
1393+
- API Gateway returns a response without sending the request to the backend
1394+
- Integration Type HTTP / AWS (Lambda & AWS Services)
1395+
- you must configure both the integration request and integration response
1396+
- Setup data mapping using mapping templates for the request & response
1397+
- Integration Type AWS_PROXY (Lambda Proxy):
1398+
- incoming request from the client is the input to Lambda
1399+
- The function is responsible for the logic of request / response
1400+
- No mapping template, headers, query string parameters... are passed as arguments
1401+
- Integration Type HTTP_PROXY
1402+
- No mapping template
1403+
- The HTTP request is passed to the backend
1404+
- The HTTP response from the backend is forwarded by API Gateway

0 commit comments

Comments
 (0)