Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mfkimbell/aws-serverless-zoo-management
https://github.com/mfkimbell/aws-serverless-zoo-management
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mfkimbell/aws-serverless-zoo-management
- Owner: mfkimbell
- Created: 2024-07-28T18:27:07.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-16T15:29:21.000Z (2 months ago)
- Last Synced: 2024-10-18T12:22:44.718Z (2 months ago)
- Language: Python
- Size: 502 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aws-serverless-zoo-management
## AWS SAM Serverless Zoo Manager
A serverless AWS project that uses a full AWS SAM template. It builds an animal registry API Gateway API for new and born animals. It also uses a Cloudwatch Bus Rule to trigger a Lambda to automate the feeding for animals. Animals are stored in a DynamoDB database, and the animal processing is done through a Step Function with a Map to process the Lambda functions simultaneously.## AWS Game Day Event
We were provided set AWS enviornments that were linked to unit tests that determined if our program was working. There were two main tasks, the birth registry and the automation. My team in particular recieved bonus points for being the first to complete the birth registry first. There was a live dashbaord that broadcast the team's points. We finished the entire project in just under the 8 hour time limit.## Learning to lead
I was the one of the designated full time employees that got to lead an interns group. I had a lot of fun teaching the interns how to use AWS and helping them work through problems in the hackathon. I assigned them various introductory skills videos and led them to do workshops and get hands on with the tools before the hackathon. For instance, I had them build a basic CRUD API with API Gateway, Lambda, and DynamoDB. As the hackathon went on, I was more comfortable designating tasks and directing the interns. I was better about instructing how to troubleshoot rather than troubleshooting for them. I learned to be more direct in my advice: simple things like making sure they knew the requirements, the overall goal, and how to break them down into digestable tasks. I learned to help them think about architecture flow and to ask the right questions when they're stuck, rather than just saying "it's not working". I hope to take these skills and carry them onto my more senior positions.## Setup VScode with SAM
* ``` brew install aws cli ``` installs aws cli
* ``` aws configure ``` sync with account
* ``` brew tap aws/tap ``` wrapper
* ``` brew install aws-sam-cli ``` install sam cli
* ``` sam -h ``` to check if it works## Sam Commands to know
* ``` sam init ``` create sam template
* ``` sam validate ``` validates syntax of template
* ``` sam deploy --guided ``` deploy the sam template
* ``` sam sync --stack-name sam-app --watch ``` sync application to automatically make different udpates depending on saved changes
* ``` sam logs --stack-name sam-app --tail ``` locally streams all logs to terminal## Lambda Functions
* **register_animal:** takes in a list of animals and adds them to a dynamoDB database. If they don't already have a birth date, it assumes they've just been born and gives them a DOB.
* **start_step_function:** used to initiate the step function from the "registerAll" API route
* **test_populate_zoo_registry:** initiates some test data to work with in the database
* **update_feeding_times:** scans the database, if the current floored time matches one of the feeding times, it updates the "lastFed" field for the animals that match. An eventbridge eventbus bus rule triggers this function every hour.## Step Function
batch processes the animals and uses "map" to call the lambda functions concurrently## Example POST to API for registering
``` python
curl -X POST https://2dkpi4e09c.execute-api.us-east-1.amazonaws.com/Prod/registerAll \
-H "Content-Type: application/json" \
-d '{
"input": {
"request": {
"animals": [
{
"species": "Elephant",
"feedingSchedule": [
"10:00 AM",
"02:00 PM",
"08:00 PM"
]
},
{
"species": "CAT Lion",
"feedingSchedule": [
"09:00 AM",
"01:00 PM",
"05:00 PM"
]
},
{
"species": "CAT Giraffe",
"feedingSchedule": [
"07:00 AM",
"11:00 AM",
"04:00 PM"
]
}
]
}
},
"inputDetails": {
"truncated": false
}
}'
```Data populated by "test_populate_zoo_registry":