AWS Database Options - ActoKids/api GitHub Wiki

Database Options Research:

  1. MongoDB on an EC2 instance https://docs.mongodb.com/ecosystem/platforms/amazon-ec2/ https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/ t3.micro 2 Variable 1 GiB EBS Only $0.0104 per Hour -> per month about 8$ Data Transfer IN To Amazon EC2 From Internet All data transfer in $0.00 per GB Data Transfer OUT From Amazon EC2 To Internet Up to 1 GB / Month $0.00 per GB This is a good option unless DynamoDB is free.

  2. MongoDB Atlas https://www.mongodb.com/cloud/atlas/aws-mongodb?utm_medium=referral&utm_source=aws_quickstarts https://docs.mongodb.com/ecosystem/platforms/amazon-ec2/#deploy-mongodb-ec2 MongoDB Atlas is an automated cloud MongoDB service and deploys MongoDB on AWS EC2 instances. Supports scaling, geographically distributed database instances to ensure no single point of failure. Backups are extra for pricing but the pricing would be comparable to mLab, maybe higher. There is a free option for under 512mb storage.

*** comparison of mLab and Atlas: https://scalegrid.io/mongodb/hosting-comparison.html scalegrid is another option among many more options

  1. MongoDB mLab AWS https://mlab.com/aws/ https://aws.amazon.com/marketplace/pp/B00KHWYQL0 mLab is a fully managed cloud database service featuring automated provisioning and scaling of your database's compute, memory, and storage resources. MongoDB databases, backup and recovery, 24/7 monitoring and alerting, web-based management tools, and expert support. mLab can be set up to work in AWS I'm guessing via an ec2 on their part but it is not clear. Once disadvantage For pricing it seams best to use Shared Cluster for a small non-profit. A cluster whose daily average file size value is 1.5GB throughout an entire month would pay $22.50 for that month based on a rate of $15/GB/month. This service includes: custom alerts, daily backup, vertical scaling for zero downtime. Also, free tier around 500mb storage

  2. Firestore with AWS https://medium.com/@samstern_58566/how-to-use-cloud-firestore-on-aws-lambda-4bf6d3a473d9 This option would is better when using with Google Cloud Functions as it requires less set up and works out of the box. Pricing is based off read, write, delete operations; amount of storage; and amount of network bandwidth. See this link for more info https://firebase.google.com/docs/firestore/pricing. I don't see any benefit of using an outside vendor from AWS with AWS, I can't find any either.


Test for DocumentDB and Lambda:

To start the cost for testing was already about 60$ (40$ from Zak's repo and 20$ from mine), so using DocumentDB is a no go. On-Demand Instances let you pay by the hour so the cost was mostly for the time on (see billing details below). For this demo I opened a DocumentDB cluster, EC2 instance, and two Lambda functions. With the EC2 instance I was able to read and write to the database using SSH however with the Lambda functions I kept receiving 500 response (internal server error). A major problem is how new DocuementDB is and this results in a lack of documentation and online resources. The only way to get help is to open a support ticket but this seems pointless at the price of using the service for only one day being 40$. My recommendation is to run from DocumentDB and never use it. Using a regular EC2 with MongoDB would be much cheaper. Time spent was about 8 hours. Here is the repo to see the code -> https://github.com/ActoKids/api/tree/travis_feature/db_research/travis-database-research/DocumentDB_Lambda_Test

For the demo I used this website, https://hackernoon.com/building-a-serverless-rest-api-with-node-js-and-mongodb-2e0ed0638f47, as a start but only used what was needed.

BILLING DETAILS FOR MY ACCOUNT (not including Zak's) Amazon DocumentDB (with MongoDB compatibility) $20.55 $0.021 per additional GB-month of backup storage exceeding free allocation for Amazon DocumentDB0.000002 GB-Mo$0.00 $0.10 per GB-month of consumed storage (Amazon DocumentDB)0.000002 GB-Mo$0.00 $0.20 per 1 million I/O requests (Amazon DocumentDB)247,553 IOs$0.05 $0.277 per db.r4.large instance hour (or partial hour) running Amazon DocumentDB74 Hrs$20.50 Total = $20.55

Test for DynamoDB and Lambda:

Because this mostly seemed a waste of helping the team I also implemented a demo with DynamoDB and Lambda and helped my group get a demo working. One problem we had was CORS, I found a way for the demo to work but we could use an explanation or lecture of how to set this up correctly. Here is the repo to see the code -> https://github.com/ActoKids/api/tree/travis_feature/db_research/travis-database-research/DynamoDB_Lambda_Test