AWS Mini-Project – Cats Need Love Too

Completed my first AWS Mini Project today. The services used were DynamoDB, Lambda, and SNS.

I first created a DynamoDB table where I manually entered in fictional data for a cat adoption agency. I entered in 8 kittens, their names and adoption statu…


This content originally appeared on DEV Community and was authored by zyounger8

Completed my first AWS Mini Project today. The services used were DynamoDB, Lambda, and SNS.

I first created a DynamoDB table where I manually entered in fictional data for a cat adoption agency. I entered in 8 kittens, their names and adoption statuses. In a real world example this would have been populated from a front-end website. In an ideal world all cats would have homes with all the cat nip and sunlight a kitten could dream of.

Image description

After creating my table I explore the comparison of querying the data in the table versus running a scan of the existing records. Querying the data appears to be more efficient, eliminating the need for DynamoDB to iterate over every record, however I will use scanning later in the project.

Next I set up an SNS email protocol. In simple terms AWS SNS is a messaging service that will allow me to send messages and notifications to any subscribed member in my cat loving community that is interested in adopting a cat. In this example they will be receiving updates when a cat is adopted encouraging them to hop onto the site if they want to adopt one before they are all gone.

Image description

Now onto creating the Lambda function, which is named cat-adoption-function. In this portion I inserted code that will iterate through all the cat records that Dynamo DB passes to the Lambda function, and then publish the message for our subscribers to receive.

Image description

Image description

Next, I gave the Lambda function created permission to access DynamoDB so it can read the data from the DynamoDB Stream. Without this permission, the function created will not work.

Next, I enabled the DynamoDB Stream that will trigger that cat-adoption-function every time a cat's adoption status is changed to true.

The final step involved testing it out. In the DynamoDB console I ran a scan to ensure the code is working as expected and that the Lambda function is correctly reading and processing all of the table items. At the initial scan all of the adoption statuses were set to false. In a real world example this testing phase will be crucial to identify any data insertion, bug, and performance issues that could occur with larger datasets.

Image description

To test the trigger, I changed the adoption status of one of the cats to true in the DynamoDB table. Upon making the status change I received an email notifying me that the cat selected has been adopted!

Image description

As best practice with all projects, my final step involved cleaning up, by deleting all the resources used in this project.

And voila! There goes my first project, looking forward to the next. Shout out to my favorite AWS course that is helping develop these skills and support my learning with these projects: adrian cantrill

Cover Photo by The Lucky Neko on Unsplash


This content originally appeared on DEV Community and was authored by zyounger8


Print Share Comment Cite Upload Translate Updates
APA

zyounger8 | Sciencx (2023-04-15T15:00:26+00:00) AWS Mini-Project – Cats Need Love Too. Retrieved from https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/

MLA
" » AWS Mini-Project – Cats Need Love Too." zyounger8 | Sciencx - Saturday April 15, 2023, https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/
HARVARD
zyounger8 | Sciencx Saturday April 15, 2023 » AWS Mini-Project – Cats Need Love Too., viewed ,<https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/>
VANCOUVER
zyounger8 | Sciencx - » AWS Mini-Project – Cats Need Love Too. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/
CHICAGO
" » AWS Mini-Project – Cats Need Love Too." zyounger8 | Sciencx - Accessed . https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/
IEEE
" » AWS Mini-Project – Cats Need Love Too." zyounger8 | Sciencx [Online]. Available: https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/. [Accessed: ]
rf:citation
» AWS Mini-Project – Cats Need Love Too | zyounger8 | Sciencx | https://www.scien.cx/2023/04/15/aws-mini-project-cats-need-love-too/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.