General Lambda root readme

This commit is contained in:
Nathan Merz 2020-11-20 14:00:24 -05:00 committed by GitHub
parent 415ebe6a3d
commit 13f9c4ba1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

35
Lambdas/README.md Normal file
View File

@ -0,0 +1,35 @@
## Components
### APIs
Contains logic to retrieve data from merchant APIs.
### Lists
Contains client-facing Lambdas which are typically a rather thin wrapper over the database (MariaDB on AWS's RDS service) and other AWS services.
#### General Client-facing Serverside Flow
```
Client -> API Gateway endpoint -> Lambda -> (same) API Gateway endpoint -> (same) Client
| . | .
\ / / \ \ / / \
' | ' |
AWS Cognito MariaDB instance/Other AWS services(SES, Cognito)
```
### Scraping
Contains logic to orchestrate runs using a scraping utility to collect merchant data and store it in the database
## Common Troubleshooting
#### Logs
- Logs may be written to by printing to the stdout. (Fancier logging is also possible, but currently not implemented)
- Logs are avalaible on AWS's Cloudwatch under Log Groups -> {Lambda name}
- Logs typically persist after deletion of the associated Lambda
#### Incomplete runs
Often if a run fails to complete, it is because the standard allocated time and memory/cpu is inadaquate.
- Symptoms:
- The running time (available in the Cloudwatch logs) is almost exactly the maximum time.
- Resolutions:
- Time may be increased.
- CPU may be increased. CPU is proportional to memory, so CPU is increased by increasing memory allocation.