Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What would be the AWS equivalent to Firebase Realtime Database?

I'm working on a new game project at the moment that will consist of a React Native front-end and a Lambda-based back-end. The app requires some real time features such as active user records, geofencing, etc.

I was looking at Firebase's Realtime Database that looks like a really elegant solution for real-time data sync but I don't think AWS has anything quite like it.

The 3 options I could think of for "serverless" realtime using only AWS services are:

Option 1: AWS IoT Messaging over WebSockets

This one is quite obvious, a managed WebSockets connection through the IoT SDK. I was thinking of triggering Lambdas in response to inbound and outbound events and just use WebSockets as the realtime layer, building custom handling logic on the app client as you typically would.

The downside to this, at least compared to Firebase, is that I will have to handle the data in the events myself which will add another layer of management on top of WebSockets and will have to be standardized with the API data layer in the application's stores.

Pros:

  • Scalable bi-directional realtime connection

Cons:

  • Only works when the app is open
  • Message structure needs to be implemented
  • Multiple transport layers to be managed

Option 2: Push-triggered re-fetch

Another option is to use push notifications as real-time triggers but use a regular HTTP request to API Gateway to actually get the updated payload.

I like this approach because it sticks to only one transport layer and a single source of truth for application state. It will also trigger updates when the app is not open since these are Push Notifications.

The downside is that this is a lot of custom work with potentially difficult mappings between push notifications to the data that needs to be fetched.

Pros:

  • Push notifications work even when app is closed
  • Single source of truth, transport layer

Cons:

  • Most custom solution
  • Will involve many more HTTP requests overall

Option 3: Cognito Sync This is newer to me and I'm not sure if it can actually be interfaced with from the server.

Cognito Sync offers user state sync. across devices complete with offline support and is part of the Cognito SDK which I'll be using anyway. It sounds like just what I'm looking for but couldn't find any conclusive evidence as to whether it is possible to modify, or "trigger", updates from AWS and not just from one of the devices.

Pros:

  • Provides an abstracted real-time data model
  • Connected to Cognito user records OOTB

Cons:

  • Not sure if can be modified or updated from Lambdas

I'm wondering if anyone has experience doing real-time on AWS as part of a Lambda-based architecture and if you have an opinion on what is the best way to proceed?

like image 227
BarakChamo Avatar asked Sep 20 '16 08:09

BarakChamo


People also ask

Does AWS have a Realtime Database?

AWS database services for real-time applications MemoryDB stores your entire database in-memory and uses a durable, Multi-AZ transactional log, so you can use it as an ultra-fast, primary database.

Does AWS have a Firebase equivalent?

AWS Amplify and the AWS CDK Unlike Firebase, where the products and integrations are part of a singular platform, Amplify and the AWS CDK provide an abstraction layer for many different AWS services, each with their own dedicated roadmap, support, and engineering teams.

Is DynamoDB a Realtime Database?

It is a cloud-hosted NoSQL database that lets you store and sync data between your users in realtime. Data is synced across all clients in realtime, and remains available when your app goes offline. Amazon DynamoDB and Firebase Realtime Database can be categorized as "NoSQL Database as a Service" tools.

When to use firebase in AWS?

Firebase is useful when the project size is small to medium. You can use AWS for small, medium, large, and enterprise-level applications. Firebase provides user authentication, crashlytics, cloud storage, cloud store, push messaging, real-time database, etc.

What is the difference between Cloud Firestore and Firebase?

While the Firebase Realtime Database is basically a giant JSON tree where anything goes and lawlessness rules the land 1, Cloud Firestore is more structured.

What is Firebase Realtime Database?

Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON documents and synchronized in real-time to every connected client. Firebase does not use HTTP requests for communication between client and server; the Realtime Database uses data synchronization.

Is Firebase baas or PaaS?

You can call Firebase as a Platform as a Service ( PaaS) or Backend as a Service ( BaaS ). Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON documents and synchronized in real-time to every connected client.


1 Answers

I asked a similar question to the AWS Support, and this was their response.

My question to them:

What's the group of AWS services (if it's possible) to give that same in-browser real-time DBaaS feel like Firebase?

AWS Cognito seems to be great for user-accounts. Is there anything similar for the WebSockets / real-time DB part?

Their response:

To your question, Firebase is closest to the AWS service AWS MobileHub. You can check out more details below about mobilehub from below link.

https://aws.amazon.com/mobile/details/ https://aws.amazon.com/mobile/getting-started/

"AWS Cognito seems to be great for user-accounts. Is there anything similar for the WebSockets / real-time DB part?"

Amazon Dynamodb is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed cloud database and supports both document and key-value store models. Its flexible data model, reliable performance, and automatic scaling of throughput capacity, makes it a great fit for mobile, web, gaming, ad tech, IoT, and many other applications.

Amazon Dynamodb can be further optimized with Amazon DynamoDB Accelerator (DAX) which is a fully managed, highly available, in-memory cache that can reduce Amazon DynamoDB response times from milliseconds to microseconds, even at millions of requests per second.

For more information, please see below documentation.

https://aws.amazon.com/dynamodb/getting-started/ https://aws.amazon.com/dynamodb/dax/

Should you have any further questions, please do not hesitate to let me know.

Thanks.

Best regards,

Tayo O. Amazon Web Services

Check out the AWS Support Knowledge Center, a knowledge base of articles and videos that answer customer questions about AWS services: https://aws.amazon.com/premiumsupport/knowledge-center/?icmpid=support_email_category

Also while researching this answer I also found this, looks interesting:

https://aws.amazon.com/blogs/database/how-to-build-a-chat-application-with-amazon-elasticache-for-redis/

The comments to that article is interesting as well.

Jacob Wakeem: What advantage this approach have over using aws iot? It seems that iot has all these functionality without writing a single line of code and with server-less architecture.

Sam Dengler: The managed PubSub feature in the AWS IoT service is also a good approach to message-based applications, like the one demonstrated in the article. With Elasticache (Redis), customers who use Pub/Sub are typically also using Redis as a data store for other use cases such as caching, leaderboards, etc. With that said, you could also use ElastiCache (Redis) with the AWS IoT service by triggering an AWS Lambda function via the AWS IoT rules engine. Depending on how the message-based application is architected and how the data is leveraged, one solution may be a better fit than the other.

like image 137
Quang Van Avatar answered Sep 21 '22 12:09

Quang Van