In case of a event driven serverless stack with a HTTPS call in a Rest API and the trigger of another lambda to answer in a Websocket API, what is the best solution between SNS lambda trigger or aws sdk invoke in a asynchronus event architecture?
I can clearly see why choosing aws sdk invoke:
No need to implement another service, easier
Invoke is made by direct invoke from the code of lambda (fast, no duplicates, ...)
So I can't see the usefullness of adding SNS in between insted of a lot more configuration.
Just for more information, the second lambda is like a microservice to answer on websocket.
Related
On my current architecture, I have a NodeJS application that posts a message on SQS, which triggers a lambda function that (finally) puts the result on MongoDB. While the lambda is running, the NodeJS app pools MongoDB until the status field changes to SUCCESS or FAILED.
I would like to change this architecture to be event-driven rather than relying on pooling. To achieve that I considered changing both the NodeJS app to subscribe to a SNS topic and the Lambda function to post the result to that topic.
However, I faced a challenge when attempting to subscribe to the SNS topic. The subscribe method demands an Endpoint to confirm the subscription, and the NodeJS in question is not exposed (it's not an API). So how could the subscription be confirmed?
I understand that AWS might want to avoid spams by implementing subscription confirmation for SMS and Email, but on this case, the subscriber is a simple application...
Is there any way to subscribe tot he topic without exposing the NodeJS application? Or SNS is not the appropriate solution here?
I have used RabbitMQ for this on the past, but I would rather not deploy an instance and instead leverage a platform-as-a-service type of product.
Sometimes my backend database goes offline and the AWS lambda execution which requires this backend fails. Can I ask AWS to reprocess the same event in a later time hoping that the backend goes online by that time? I'm using node.js for my lambda code.
Yes, you can use AWS lambda's DLQ service. It sends all failed executions to SNS/SQS, you can review them and reprocess them from their.
Link to doc https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html (scroll to AWS Lambda function dead-letter queues)
I'm working on a collaborative document project (basically a clone of google docs), where client-programs post their actions to an API on amazon's API gateway, then receive messages of other client's actions via an SQS queue. The API calls trigger Node.js lambda functions that create a message, publish it to an SNS which then notifies each client's SQS.
My current hurdle is in dynamically creating/destroying SQS queues for these clients as they join/leave a document, however my googlefu is weak and I have failed to find anything that could help me. I'd like to keep the queue management server-side and ideally in lambda, but if that's impossible I will accept other solutions.
You can simply use the AWS SDK for Javascript in your AWS Lambda function (it's already pre-installed there) and use it to manage any kind of AWS resources, e.g. the requested creation and deletion of SQS queues.
Hi I am new to Python as well as AWS SNS services.
I want to develop a Python utility which would perform a role of subscriber as well as publisher to automate some simulations.
I am stuck where I need to design endpoint which would act as a SNS message receiver.
Could you guys please guide me on this topic.
AWS Lambda is a nice service for such scenarios and also it is quite cheap so will keep your AWS bills low.
You need publisher and subscriber for SNS in python so use AWS Lambda which will give you a nice connectivity with AWS SNS and there are few samples for subscribers which will help you in configuring the same.
So now your events get into AWS SNS and through subscription of lambda you can invoke Lambda function and take the action accordingly.
Event ---> SNS ---> Lambda Subscriber ---> Python Functions
Here is a nice reference for the same.
For publisher, you can use scheduled Lambda Function which will keep on pooling for some event to occur and then depending upon event you can send the notification to same SNS endpoint or different.
Event <--(Pooling)- Lambda Publisher(Cron Based) --(Event Occurred)-> SNS
Here is the AWS Tutorial for the same.
I hope this helps.
PS: Just keep in mind that maximum runtime for any Lambda function should not exceed certain limit which is 5 mins currently.
Does AWS Lambda provide a way to make a public route/endpoint for my Lambda functions?
Or do I have to build an entire app to handle routing and invoking Lambda functions?
Yes they do!
As of July 9th they have an api endpoint section that allows you to invoke your lambda function from anywhere!
http://aws.amazon.com/about-aws/whats-new/2015/07/invoke-aws-lambda-functions-over-https/.
You can also use API gateway with lambda to design and test your api.