AWS S3 Static Website Push Capability - amazon-web-services

Is there a way for me to have a static website on S3 that uses lambda and api gateway for services but to have messages pushed from lambda (that originated from a scheduled run) instead of polling for new information?
I was thinking of using IOT, but im not too familiar with it im not sure if a website can be a IOT thing, the documentation doesnt really help much with configuring your things.
Any other ideas?
Thanks

Answer from MaiKay looks like exactly what i wanted to achieve, blog post even has a small demo where messages can be pushed to a session running in another tab:
You are able to use IoT for it. A nice article can be found here: https://serverless.com/blog/serverless-notifications-on-aws – MaiKaY

Related

Can someone demystify EMR/EC2/Lambda/SNS/SQ in AWS services for me?

I have a reason for this question. So I would appreciate positive responses.
AWS is a black box to me.
In my mind all services offered by AWS are plug play. So AWS has a user interface where you register a bunch of info and you click a button and AWS takes care of it.
But clearly that's not the case because there are AWS services based interview questions.
So I am not sure if there is a coding element to it. Can someone demystify AWS and all its services on a higher level to me ?
Like AWS EMR/EC2/Lambda/SNS/SQS - Just a one word response is fine. Right now to me its a button clicking services with zero coding or skill. But clearly I am wrong.
Right now to me its a button clicking services with zero coding or skill. But clearly I am wrong.
I'm going to assume that your question is something along the lines of why they're called "web services", rather than what each service does. If the latter, then you've gotten a lot of links in the comments. I'd also Google for Amazon's Cloud Practitioner videos.
The reason why AWS is called a web service is because that's exactly how they work: when you want to do something, you make a GET/POST/PUT/DELETE to the endpoint for a service. For example, to send a message to an SQS queue in the us-east-1 region, you make a POST request to https://sqs.us-east-2.amazonaws.com.
Each of these requests is signed, using an access key and secret key. If you don't properly sign a request, it will be rejected.
While you can construct these GET and POST requests yourself, AWS provides a bunch of language-specific SDKs that do it for you. For example, if you want to send a message to an SQS queue using Java, you would write something like this:
AmazonSQS client = AmazonSQSClientBuilder.defaultClient()
// this is available from the console, or you could make another call to retrieve it if you know the queue name
String myQueueUrl = "...";
client.sendMessage(myQueueUrl, "an example message");

How do I save an html form post to two databases? Rabbitmq vs Redis pub/sub?

I have a Flask microservice that needs to save a form post to both AWS DynamoDB (thru boto3) and to Elastic Search DB (running on EC2). I first considered writing a Python AsyncIO server to implement a broker/Observer pattern but it looked like re-inventing what Rabbitmq/Redis PubSub already does. However, I couldn't find straight forward documentation (both doc sites) and therefore, I am looking for an example of this common pattern. Any pointers would be helpful and I will appreciate your help.
Thanks,
Looks like you are using AWS already, so why not use SNS. You can create a form_post_topic with two subscribers (DynamoDB and ElasticSearch) and you send messages to that topic.

Using DynamoDB from CakePHP 3 installed to Elastic Beanstalk

I have installed CakePHP 3 using directions from this tutorial:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-cakephp-tutorial.html
It is working perfectly and actually installation was quite easy. There is PHP, CakePHP, MySQL working and also I noticed that the newest AWS SDK as whole is installed in vendor directory. So I am fully set to use also DynamoDB as my data source. You might ask why I should use DynamoDb since I am already using MySQL/MarianDB, this is because we have an application that is already in production and it is using DynamoDB. But we should be able to write admin application using CakePHP in top of DynamoDB. This is not technical decision but coming from business side.
I found good tutorial written by StarTutorial how to use DynamoDB as session handler in CakePHP 3:
https://www.startutorial.com/articles/view/using-amazon-dynamodb-as-session-handler-in-cakephp-3
Well, there is not long way to using DynamoDB for putting data, getting data and doing scans, isn't there? Do you have any simple example how to do it, how to write data to DynamoDB or do scan?
I have also read the article:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.PHP.html
and this is working fine, no problem. But I would like to all the advantages of the CakePHP 3, templating, security and so on, thousands of hours time saved with well written code and very fast to start coding for example admin console :)
Thank you,
You could create a Lambda function (in case you want to go serverless) or any other microservice to abstract communication with your DynamoDB. This will definitely simplify your PHP code. You may call Lambda functions directly (via API Gateway), or post messages to SQS for better decoupling. I would recommend the use of SQS -- you'll need some kind of microservice anyway to consume messages and deal with your DynamoDB in a CQRS fashion. Hope it helps!
Thank you for your answer, I was looking for a example how to use the AWS SDK for DynamoDB without creating more complexity to this environment as it is. This way I would have to create yet another layer without using the SDK that already exists. Can you please give wokring example how AWS SDK is used from CakePHP 3 so that it can use DynamoDB as a data source for its applications without losing it´s own resources an capabilities (MVC, security etc).
Thank you,
After a hard debug and found bugs I was able to get it working with only using AWS SDK in CakePHP 3.

AWS DynamoDB Stream example for App?

I used Firebase to create a chat app. But I plan to move the backend from google to AWS. I found that DynamoDB support a Stream function is very similar to Firebase in AWS Website.
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html
If someone adds a new message. Firebase and DynamoDB will notify clients the change. It is the basic feature of a chat app. Looks like DynamoDB Stream should be an alternative of Firebase.
But I notice that the documents and examples of DynamoDB Stream is very rare. And the weirdest is the tutorial has been removed
https://aws.amazon.com/getting-started/projects/build-mobile-messaging-app-ios/?nc1=h_ls
Click Get Started will be redirected to MobileHub.
I wonder if the DynamoDB Stream function is not supported in the future? And this service will be replaced by MobileHub.
And I used another function of MobileHub in another app development. But not figure out how to use MobileHub to build a chatting function
If I want to use AWS to build a chat app. What is the best solution? Is any useful example or tutorial for DynamoDB Stream? Thanks very much.
This is how I would solve it,
These things are not yet wired up yet. Here is how you can do it.
DynamoDB (Streams) --> Lambda --> SNS
Subscribe to streams, changes will be delivered to your Lambda, you can customize how the message should look like and send notification with SNS.
Hope it helps.

Amazon Mechanical Turk task retrieval API

I'm writing an app wherein the premise is that people who can't directly fund a charity out of their pocket could automatically work on Amazon AWS HITs in order to bring clean water to the 3rd world - I'd known there was an Amazon AWS API but is very unclear on how to retrieve a HIT to be worked on, rather than just consume some data about some tasks I'm trying to complete.
Is there any way to retrieve a HIT to be worked on through the AWS API or otherwise?
Thanks ahead of time.
As far as I know, the only way to work on a HIT is through the mTurk website. i.e. - not via API.
There is a site that is trying to do something very similar to what you have described. http://www.sparked.com/