DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Jones Zachariah Noel
Jones Zachariah Noel

Posted on

AWS SAM app with MongoDB Atlas Data APIs

This is the implementation of a typical web app backend where the MongoDB Atlas is leveraged to store data.

Overview of My Submission

The SAM app uses MongoDB Atlas for database choice which contains two collections - shield_agents and shield_locations. This stores the S.H.I.E.L.D info such as the database of all agents and non classified locations. The operation of INSERT and GET is integrated with MongoDB Atlas Data APIs where the API credentials are created and passed into AWS Lambda fns as environment variables with CloudFormation Parameters. The APIs from SAM app are exposed with AWS API Gateway. Also have the Search enabled with indexes.
MongoDB dashboard

Submission Category:

Choose Your Own Adventure, the first time I'm using MongoDB and Data APIs so went a step to adapt it into my usual tech-stack (AWS Serverless) with a AWS SAM application.

Link to Code

shield-database

This is a repository which uses MongoDB Atlas Data APIs for CRUD operations with AWS SAM application.

Deployment commands

Create a new directory, navigate to that directory in a terminal and clone the GitHub repository

git clone https://github.com/zachjonesnoel/shield-database
Enter fullscreen mode Exit fullscreen mode

Change directory to the pattern directory:

cd shield
Enter fullscreen mode Exit fullscreen mode

From the command line, use AWS SAM to deploy the AWS resources for the pattern as specified in the template.yml file:

sam build
sam deploy --guided
Enter fullscreen mode Exit fullscreen mode

Recouces




Screenshots

Creating an agent with insertOne API
Create agent
Getting one of the created agent with findOne API
Get created agent
Creating a location with insertOne API
Create location
Getting one of the created location with findOne API
Get created location
MongoDB Atlas Search helps in creating an index for a collection and using the index to query and check if the filter pattern matches any record. The matching records also return a match score.
Atlas Search
MongoDB Atlas Charts can help you visualize data.
No of locations -
MongoDB Atlas Charts - locations
Agents with security clearance level-
MongoDB Atlas Charts - security level

Additional Resources / Info

Top comments (0)

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: