DigitalOcean Functions: Free AWS Lambda Alternative by DigitalOcean

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




DigitalOcean Functions is new feature of DigitalOcean where you can create serverless functions in different programming languages and execute them at will. Think of it as an alternative to AWS Lambda and is free to use as well. It is offering a generous free tier to developers and all users of DigitalOcean. You can make use of these functions in your apps or for some other things. All the functions that you create here can be invoked by making a get request to a unique URL that it gives you.

For now, DigitalOcean Functions support 4 programming languages. You get a simple code block to extend and you can include the external packages as well. Write the script in the form of a function and then save it. It lets you test your functions as well. Not only that but there is a logging system as well. So, in case some of your functions fail to execute then you can quickly peek into the errors logs to understand what went wrong.

You can create as many functions as you want. However, if you want to stay in the free limits then you will have to plan things accordingly. After deploying the functions, you can activate them manually or programmatically. All the documentation is there and you can manage your functions using DigitalOcean CLI as well. For more details, you can read about it on the main website.

DigitalOcean Functions Free AWS Lambda Alternative

DigitalOcean Functions: Free AWS Lambda Alternative by DigitalOcean

In order to use DigitalOcean Functions, you need to have an account on the cloud. After that, you go to the new Functions section and then from there, you simply need to create your function.

Give it a name and then select a programming language from the list. It supports the following programming languages for now. If your script is going to use a package then you have to declare that here as well.

  • Node.js
  • Python
  • Go
  • PHP

DigitalOcean Create Function

Go to the source section and then from there, you can start writing down the code for your function script. Do the imports and then write the worker code inside the function. See the example below, that I have created. This function when invoked, gets the current IP address of the system and then POST it to a webhook.

DigitalOcean Function Write Code

After writing the code, you can test it as well. And doing that is very easy actually. Click on the Run button and then see the output. It produces logs as well and from this test run, you can ensure that your function is working.

DigitalOcean Function Outout and Log

In this way, you can now use DigitalOcean Functions with ease. You can create and save other functions as well in different programming languages. You can keep tracking the usage from Insights section. And when you no longer need some function, you can simply remove it. Refer to the following section to understand the pricing model for DO Functions.

DigitalOcean Functions Pricing:

You can start for free with functions and then save them. DigitalOcean will assign resources to it and based on the activations and memory consumption, it will charge for you. For free, your functions can run for 90000 GB seconds. 1 Gigabyte-second is equivalent to the amount of memory allocated to a task per second.

  • Task 1: 1 GB * 10 seconds = 10 gb-sec
  • Task 2: 128 MB * 10 seconds ~ 0.128 GB * 10 Seconds = 1.28 gb-sec
  • Task 3: 8 GB * 10 seconds = 80 gb-sec

If you are a early startup or an individual then the free plan is enough to get you started with this for free.

You can access logs anytime. To do that, go to the functions and then there is Logs section. If some function emits some error then it will show them there with red color. In addition, you can filter those functions by execution time as well.

Final thoughts:

So, if you are a site reliability engineer or in DevOps like line of work then you will like this new tool by DigitalOcean. Create and host your functions easily and do specific task by simply accessing them via URL. It works perfectly, I tried using Python and the only addition here would be an option to schedule a time at which certain function can be run automatically.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]

Get 100 GB FREE

Provide details to get this offer