2

I have a function within my R Shiny app which takes a minute on good days. In order to deploy the app, I would need to use something like the promises package to ensure its performed asynchronously. However, I'll run into possible CPU limits as well if the app scaled and possible prohibitive costs.

I'd like to farm this function out to AWS Lambda -- I feel, from what I've read, that this would be a neat option. I read somewhere that AWS Lambda can look for new information stored into an S3 bucket and kick-off a Lambda.

So, my thought was that the R Shiny user would hit a button, it would send the information to an S3 bucket (I suppose with write access only), until the AWS Lambda grabbed it, performed the function, and returned the output back into an S3 bucket where the user would then be notified of his persistent storage.

AWS Lambda (if possible) would delete the original record.

1.) Is this a good idea?
2.) Is there a better idea?
3.) If yes to (1), is there anything that could possibly help me uncover whether this is possible?
4.) If (3) is answered, how can a user be notified in R Shiny of a new S3 user-specific persistent sub-setted table available?

Thank you!

1

1 Answer 1

0

Yes, this is a good use case for AWS Lambda. Lambda can be notified of a new object in S3, do whatever processing is required and write the output back.

Note: Double, triple check you are reading / writing to either different buckets or paths of a bucket and you don't create an infinite loop.

The Lambda function to make a call to AWS Simple Notification Service (SNS) to notify users that a task has finished after it has successfully written the data to S3.

If there are multiple users of this system then you might want to write a small manifest file to S3 which tells the Lambda function which data file to process and the email address of the person to notify.

The Lambda function would then just be triggered by the creation of the manifest.

1
  • Thank you for your response and good to know I'm on the right track. Can Lambda communicate with Rshiny in any way to let the user know that the job is done?
    – NellieG
    Jun 17, 2022 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.