1

I currently have a web app running fully on Heroku.

This web app needs a lot of computing power and access to several external APIs during short time periods, and nothing at all if there is no activity from users.

Until now, I have several workers that are idle during a long time but are not sufficient when there is a lot of activity. As a result, the users need to wait too long + I am paying money for workers that are most of the time idle.

In order to solve this, I am thinking about moving these workers to AWS Lambda. Since I am totally illiterate with AWS and any kind of server configuration in general, I am willing to keep the web itself and the database on Heroku.

The workers currently interact a lot with the database, both reading, and writing. Therefore, I am considering two possibilities:

  1. Make that the workers in AWS Lambda connect directly to the SQL Database on Heroku. Then they should be able to run SELECT ... and INSERT ... queries --> Is that possible? I only found this page and this one about it, so I am not sure if it will be easy enough to set-up (maybe I am not using the right keywords to find more information...?)

  2. Create some sort of API to do the communication between Heroku and Lambda, so the actual access to the SQL Database happens on Heroku, and the information to perform the SQL queries is what goes back and forth.

Do any of these possibilities make sense? Is there any other way to connect AWS Lambda and Heroku?

I am open to any other ideas as well.

1
0

I ran into an issue or am currently running into one still, with respect to Lambda.

Basically, Lambda starts to have problems with losing connections when the work it is doing is longer and especially if it is maintaining connections to services. I am not sure if this is limited to services outside AWS or not. In my case, my services being called by Lambda are outside AWS and Lambda is not able to do what I can do with the same JS script, external to Lambda, which suggests I am mis-using Lambda.

It is possible that you might have the same problem where your Lambda's are trying to do work on Heroku and will possibly timeout. But this is my hypothesis so far. As in, don't use Lambda until you make sure of this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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