A take home assessment using React, Python Lambda, API Gateway, DynamoDB and S3
- Python 3.10
- Node
- Docker
- AWS CLI
- SAM CLI
- Local development using SAM (✅)
- Bootstrapping local DynamoDB (✅)
- Get inventory function:
- With
datetime
filter iso standard (✅)- Validation (TBD)
- Pagination (✅ - ish)
- With
- Stats inventory function:
- Aggregate by category (✅)
- Create inventory function:
- Normalize name for consistent hashing (✅)
Sha1
hashing as primary key (✅)
- Normalize category to unique ID (TDB)
- Normalize name for consistent hashing (✅)
- Deploying to AWS using SAM (✅)
- Minor testing (not very complete 😬)
- Frontend deployment to S3 & Cloudfront (✅)
-
- Install necessary libraries from any of the
requirements.txt
- Dynamodb docker (in the
/cag-dynamodb
)docker-compose up
- Local Dynamodb (in the
/cag-app
)- install
yq
(Yaml parser, I'd prefer to use this to sync with whatever changes is done totemplate.yml
) - To bootstrap local dynamodb table:
aws dynamodb create-table --cli-input-yaml "`cat template.yaml | yq e '.Resources.InventoryTable.Properties' -`" --no-cli-pager --endpoint-url http://localhost:8000
- install
- Install necessary libraries from any of the
-
-
To invoke locally:
sam build
(every code changes need to be rebuild)GetInventoryFunction
Example:sam local invoke GetInventoryFunction -e handlers/get_inventory_handler/get_events.json --env-vars ./test_environment.json --docker-network dynamo_net;
sam local invoke GetInventoryFunction -e handlers/get_inventory_handler/filter_events.json --env-vars ./test_environment.json --docker-network dynamo_net;
CreateInventoryFunction
Example:sam local invoke CreateInventoryFunction -e handlers/create_inventory_handler/create_events.json --env-vars ./test_environment.json --docker-network dynamo_net;
StatsInventoryFunction
Example:sam local invoke StatsInventoryFunction -e handlers/stats_inventory_handler/events.json --env-vars ./test_environment.json --docker-network dynamo_net;
-
To deploy, run:
sam build
sam validate
sam deploy
-
Testing (abliet not very through.., in the
/cag-app
)python3 -m pytest tests/ -v
-
-
- For local development:
npm run dev
- For deploying:
npm run build
and drop the/dist
folder into the S3 and create invalidation on the Cloudfront CDN
- For local development: