I have an EC2 service that writes data to a DynamoDB table. I also have an app that is totally unrelated to the service. Now I want the app to display components in its UI based off the status attribute of items in the DynamoDB table.
It looks like I can have the app UI subscribe to a DynamoDB Stream. However, I need data in my table to persist for >24hrs, data in DDB Streams older than 24hrs is susceptible to removal.
I would ideally like a solution where on each new DyanmoDB write/update of the status of an item, I can send a notification to the app telling them of the change which would render a change in their UI. How can I go about making the app constantly listen, and how do I send a notification? I can't have the app directly access the database, it must go through the service.
I am new to AWS.
You do not need longer than 24 hour retention on the stream. Streams are used to emit each modification to your items, so with each change you notify your application.
Two ways I can think of to do this, both use DynamoDB streams and Lambda.
1. SNS
Amazon Simple Notification Service (SNS) is a two way messaging service which you can have your application subscribe to a topic. For every change made to to your DynamoDB table you write that to an SNS topic and your application will receive the changes to render the UI.
https://aws.amazon.com/pub-sub-messaging/
2. API Gateway Websocket
An altern to SNS messaging is API Gateway Websocket which allows your application subscribe to a network connection. This is more useful if you need short lived notification for given events.
https://docs.aws.amazon.com/appsync/latest/devguide/aws-appsync-real-time-create-generic-api-serverless-websocket.html
Related
AFAIK, one key difference between the two is that Appsync is implemented using MQTT and has an emphasis on real-time notification, while SNS is more like a general pub/sub service.
The real-time notification part of Appsync seems to be the right tool for a chat application. However with Appsync, I will not be able to push the notification to users if a connection is not established(?)
I would like to have real-time notification for users regardless the application is opened or not. What is the right tool for this purpose?
Generally, you'll probably have a more "ready-to-use" solution for chat using AppSync, e.g. https://aws.amazon.com/blogs/mobile/building-a-serverless-real-time-chat-application-with-aws-appsync/
Using SNS will probably provide more flexibility at the cost of more of your time wiring up custom code.
You are correct that AppSync doesn't natively support push notifications for background applications; for that, you'd need to wire in something like SNS. You could probably couple AppSync with SNS using an AppSync Lambda resolver.
Depending on your requirements, i.e. if it's not essential that a system notification appears for new messages, you can also query AppSync at app startup time for chat messages that were received while the client was disconnected.
I have industrial internet of things (IIoT) data coming from machines out in the wilderness. Currently the data are going from the machines to an Amazon Web Services (AWS) Simple Queueing Service (SQS) queue, for consumption by a third-party company.
I want to do two things now:
Put the data into the SQS queues for the third-party company, as before, and
Store the data in an Amazon Relational Database Service (RDS) database for analysis purposes
To accomplish this, should I send the data to an Amazon Simple Notification Service (SNS) topic first, and then push the data from there to both my database, and an SQS queue for the third-party company?
Is there a better way of accomplishing my objective, or am I on the right track?
I ask partly because it seems that Amazon is steering me toward a noSQL database called DynamoDB, but I think I want a structured relational database for my IIoT data.
Amazon’s IoT “message broker”, which communicates with my IoT devices using MQTT, is an SNS topic, which makes a lot of sense.
SNS message topics are different than SQS queues. Queues can only be read by one user, and then the message(s) get deleted from the queue—it’s just temporary storage. So we couldn’t share an SQS queue with the third-party company.
SNS topics, by contrast, send push notifications (and the messages) to multiple users instantly, and all “subscribed” users get the message(s). SNS is exactly like subscribing someone’s Twitter or Instagram feed, where all “subscribers” get notified of new messages from “publishers” to the message “topic”.
Long story short, we can use AWS IoT “rules” to send our devices' MQTT-secured “messages” to as many “subscribers” or AWS services as we want. So we’ll send one copy to the SQS queues, and another copy to an AWS database of some sort.
I want to develop an app that allows the users of the app (sellers on Amazon), to send me a notification when they receive an order on Amazon (a notification containing informations about the order).
Is it possible?
Maybe only the seller can receive notifications about his account.
I think, if it's possible, I need a MWS and a AWS account.
In the documentation of MWS (https://docs.developer.amazonservices.com/en_US/notifications/Notifications_Overview.html), there is:
The Amazon MWS push notifications enable you to receive information
that is relevant to your business with Amazon without having to poll
the Amazon MWS service. Instead, the information is sent directly to
you when an event occurs to which you are subscribed. For more
information about how to subscribe to receive notifications, see
Subscriptions Overview in the Amazon MWS Subscriptions API section
reference.
Then, in the 'Subscriptions API' section:
The Amazon MWS Subscriptions API section enables you to subscribe to
receive notifications that are relevant to your business with Amazon.
With the operations in the Subscriptions API section, you can register
to receive important information from Amazon without having to poll
the Amazon MWS service. Instead, the information is sent directly to
you when an event occurs to which you are subscribed.
To receive notifications, you must first create and register a
Destination, such as an Amazon Simple Queue Service (Amazon SQS)
queue. Then, you create a Subscription for the NotificationType that
you want to receive, such as a notification when another Seller has
changed their offer for an item that you also sell. Finally, verify
that Amazon is able to send notifications to your Destination by
calling the SendTestNotificationToDestination operation.
Not at this time. The only notification options are AnyOfferChangedNotification, which sends an SQS message when any one of the top 20 offers for an ASIN changes, and FulfillmentOrderStatusNotification, which notifies you if there is a multi channel order status chance, and FeePromotionNotification.
This hasn't changed since I started using the AnyOfferChangedNotification several years ago.
One idea is to create an app that uses the Orders API periodically to check for orders, then you can have the app create the SQS message (or use another service altogether). This would then notify you of a new order.
I am trying to understand AWS data sync on xamarin. they have a nice SDK to use in xamarin.forms. I am using onesignal notifications instead of aws notifications.
my question is I want to fire a notification after a data insert or sync. Onesignal has an api working with http post.
So how do I make post to onesignal endpoint when
user data is syncronized with aws cognito
a new shared data is inserted into DynamoDB
Of course I can do that on clientside but this is not a good practice. I would like to do that on the server side.
For #1, you can use Cognito events, which execute a Lambda function, whenever the data is synchronized by the user. In this Lambda function you can fire the notification.
For #2, I do not see how that is related to Cognito Sync, as the data is stored in datasets not DynamoDB. If you are talking idependently about data being inserted into DynamoDB and getting notified about that, then again DynamoDB has nice integration with AWS Lambda to send notifications on table updates.
I see AWS publish API for sending push notifications to devices.
http://docs.aws.amazon.com/sns/latest/api/API_Publish.html
According to:
https://aws.amazon.com/blogs/aws/push-notifications-to-mobile-devices-using-amazon-sns/
We can
"Send messages directly to a specific device by calling the Publish function with the device’s ARN. You can easily scale this to handle millions of users by storing the endpoint ARNs in Amazon DynamoDB and using multi-threaded code on the server."
If I want to send push notifs to 100K users (who haven't registered to a specific topic), is there a multi-publish (or batch-publish) API, where I don't need to call the "Push notifications" API for every single user?
probably not. the devices need to be registered (i.e. for SNS you actually have to create the endpoint for each device).
After you have the endpoint you can subscribe them to either one or multiple SNS endpoint and start publishing notifications through them.