Skip to content

Commit 9856bcb

Browse files
committed
docs: add arch diagram
1 parent 15084e1 commit 9856bcb

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# AWS FastAPI Lambda
22
Create an API using AWS API Gateway, Lambda and FastAPI + Mangum (based on [this walkthrough](https://towardsdatascience.com/fastapi-aws-robust-api-part-1-f67ae47390f9)):
33

4-
* Lambda is deployed in a VPC, so has access to private resources.
5-
* Currently no Internet Gateway setup, so Lambda has no internet access.
6-
* VPC endpoints have been created for CloudWatch logging/monitoring.
4+
```js
5+
┌─── AWS region ────────────────────────────┐
6+
│ ┌─── VPC ──────────────┐ │
7+
│ │ │ │
8+
Request ───► API Gateway ───► Lambda (FastAPI) │ │
9+
│ │ │ │
10+
│ │ └──────────│───────────┘ │
11+
│ ┌───────│───────────────────│───────────┐ │
12+
│ │ ▼ CloudWatch ▼ │ │
13+
│ └───────────────────────────────────────┘ │
14+
└───────────────────────────────────────────┘
15+
```
16+
17+
* Lambda is deployed in a VPC, so the function has access to private resources.
18+
* No Internet Gateway, so Lambda uses VPC endpoints for access to CloudWatch.
719

820
# Dev
921
```sh
@@ -26,7 +38,8 @@ terragrunt run-all plan # to see all the goodness that will get created
2638
terragrunt run-all apply # create all the goodness
2739
```
2840

29-
# Note
41+
# Notes
42+
## Root path
3043
The API gateway proxy integration with the Lambda function does not include a `/` root path. If you need a root path, you'll need to add this method integration:
3144
```terraform
3245
resource "aws_api_gateway_method" "api_gateway_root_method" {
@@ -45,3 +58,9 @@ resource "aws_api_gateway_integration" "api_proxy_integration" {
4558
uri = aws_lambda_function.api_lambda.invoke_arn
4659
}
4760
```
61+
## API key
62+
An API key is created and required by the API gateway. You can retrieve the key from the API's usage plan in the AWS console. To use the key:
63+
```sh
64+
curl --header "x-api-key: ${API_KEY_VALUE}" \
65+
https://${API_ID}.execute-api.${API_REGION}.amazonaws.com/dev/hello
66+
```

0 commit comments

Comments
 (0)