Search code examples
swiftdatabasefirebaseamazon-dynamodbicloud

Is DynamoDB a good choice for a Swift application?


There is an assortment of DBs available. Have poked them all. What I need is one that's cost efficient, unique user ID, able to synch off line while no wifi. And access to the backend server records (items).

iCloud, Realm, mySQL, Firebase, DynamoDB, etc. I'm fairly solid in most, would love to use DynamoDB, but I'm seeing zero docs on synching, and wondering if it's that easy to have each user be assigned a unique ID, along with the associated AWS costs.

I'm settling in on iCloud or Firebase, wondering what the Swift pros think based on my needs.

thanks for tips. :-)


Solution

  • I've used a lot of Firebase and a bit of DynamoDB. Both are respectable choices.

    I'll give you my biased view of why I chose Firebase over DynamoDB, and will let others give you the other angle:

    • DynamoDB is great if all you want to do is put and get values based on keys. However, it is quite limited when it comes to querying and searching. Firebase excels in this, in terms of usability and speed. For example, if you have a database of users, you could query based on their child value (lastLoggedIn), and choose the users who just logged in today. If this query is done frequently, you could index on this key and speed up this query. Read more here: https://firebase.google.com/docs/database/rest/retrieve-data

    • Firebase allows you to define security rules for each table/database easily. You can define IAM roles in AWS for DynamoDB too, but I doubt they have as much flexibility as Firebase.

    • Firebase allows for transactions that supports concurrent modifications: https://firebase.google.com/docs/database/web/read-and-write#save_data_as_transactions

    • If you're developing a mobile app, push notifications are easy to set up.

    • Offline capabilities are seamlessly integrated into your app without much setup: https://firebase.google.com/docs/database/web/offline-capabilities

    I used to have doubts about Firebase, but ever since Google acquired Firebase in 2014, and talked about it so fervently in 2016 at Google I/O (https://www.youtube.com/watch?v=tb2GZ3Bh4p8&vl=en), I gained faith in it.

    Oh, and did I say that the Blaze plan on Firebase is cheaper than DynamoDB for both storage and computation?