loading...

April 18, 2021

Serverless Function as a Service on Heroku

Serverless Function as a Service on Heroku

Deploying applications as Function as a Service (FaaS) in a serverless fashion results in creating a service running on a pay-per-use basis: The server with your function is only started when requested, can be started several times simultaneously and does not run when nobody needs it. This means that you do not have to pay for a fixed amount of bandwidth and are billled only for your needed computation power. Furthermore, FaaS can be scaled easily to serve a varying number of requests.

Heroku offers the opportunity to run smaller web projects for free for a limited number of hours per month. Serveless FaaS would be an ideal approach to use this free time more effectively and to allow easy scaling but unfortunately, Heroku does not really offer any serverless functions. Heroku offers one-off dynos which spin up a container for an application if it is needed. They can only be addressed from within Heroku and cannot receive any HTTP traffic.

In our tutorial on GitHub, Axel Pettersson and I describe a way on how to use these one-off dynos to create a serverless FaaS: We provide environment variables as the function parameters and read return values from the dyno’s logs. You do not need any specific programming framework for such a function; you can just create a simple script. Consult our tutorial on GitHub or GitHub pages to create FaaS for free on Heroku and interact with us directly via the ‘Issues’ section.

Posted in CloudTaggs: