ActoKids / AD440_W19_CloudPracticum

3 stars 1 forks source link

Test - Save data in DynamoDB #3

Closed Enshaedn closed 5 years ago

Enshaedn commented 5 years ago

@ActoKids/api

ZakBrinlee commented 5 years ago

Estimated time: 5-7 hours

Going to follow tutorials and start-up DynamoDB in AWS and get familiar. Will research DocumentDB as another option after DynamoDB.

toddysm commented 5 years ago

Deliverable is:

Make a call to Jonathan's API and see entry in DynamoDB (timestamp or very simple doc)

toddysm commented 5 years ago

Also, any idea of what the cost of DynamoDB per month will be.

ZakBrinlee commented 5 years ago

Expected time: ~5-7 hours Actual time: 10 hours

DynamoDB: DynamoDB is Amazon’s NoSQL database offering. DynamoDB is a fully managed service that includes built-in security, backup & restores, and multi-region as the main attractions. More info here DynamoDB provides what ActoKids needs as far as database requirements. It can handle any amount of traffic, integrates with the rest of the AWS services we are using, and since it is a fully hosted service there is no server/database upkeep.

Read/Write was pretty straight forward. I wrote two lambda functions to test the DynamoDB read/write functionality. I followed a few tutorials to get familiar with DynamoDB and Lambda. My 1st Lambda function was to read all the data in a table. Second Lambda function was a simple write using the uuid library to generate a unique key, and date function to save the date of the write function. Worked with Jon and Travis for getting it tied into the API.

DynamoDB on-demand-capacity costs are hard to estimate with small applications. More pricing info here. DynamoDB charges for reading/write throughput, the amount stored, and backups. The first 25GBs of storage are free for DynamoDB, with 0.25/GB charged for any amount over 25GB. Continuous backups with 35-day retention cost 0.20/GB per month.

DynamDB on-demand capacity mode charges only for the reads and writes that are performed. Writes to DynamoDB are charged as request units, each write unit(up to 1KB). Outside the free tier write requests are charged at $1.25 per million write requests. Read requests operate the same way but each read request unit limit is(4kb). Any requests larger than the limited amount will require additional request units to compensate. Outside the free tier read requests are charged at $0.25 per million write requests. More info here

Estimate Montly: 1000 monthly users - 50 new events a month - Each new event is 4kb 200 write units = $1.25

Each user checks app twice a week on average, each time pulls the entire table of events (50kb/4 = 13 read units) 400,000 read units = $0.25

Each month old events are deleted from DB, this will eliminate the cost of storage and always keep it under 25GB. Less than 25GB = $0

Continuous backup - DynamoDB less than 1GB - $0.20

Total: $1.70

Demo with Jon's API ping can be found here: http://sprint1-demo-bucket.s3-website-us-west-2.amazonaws.com/