Functions are blocks of code that run on demand without the need to manage any infrastructure. Develop on your local machine, test your code from the command line (using
doctl), then deploy to App Platform — no servers required. Learn more about functions.
Serverless architecture is a way to design web applications and services that doesn’t rely on managing backend infrastructure. In a serverless architecture, cloud providers like DigitalOcean provision, manage, and scale the backend servers and components required to host applications.
DigitalOcean Functions is a function as a service (FaaS) platform. Functions lets you deploy code that can perform the same tasks as a traditional API without the requirement of setting up a server to manage the requests. Each function you deploy is assigned a unique URL which you can use to anonymously test the function. You can invoke your functions and inspect their logs and results directly from your terminal.
Functions is a good fit for simple or repetitive functions with variable workloads. Functions only run in response to events or requests, and you’re only charged for what you use, so they’re most cost-effective for components with fluctuating amounts of requests.
DigitalOcean Functions and other FaaS products are designed for ease of deployment without any need to consider the underlying infrastructure. If you want more control over your production environment, consider using App Platform, our PaaS offering or Droplets, our Linux-based VMs.
DigitalOcean Functions currently offers a development environment for serverless functions from the DigitalOcean Control Panel. The development namespace is accessible through your browser and lets you connect your local development workspace to the cloud, with web-based and command line tooling to help you iterate, test, and observe your code.
The development namespace in the control panel has a simple editor, the ability to invoke your functions, change its input parameters, and view its output and logs.
When you commit your functions to a GitHub repository, you can deploy them to App Platform for a production environment. The actual runtime environment and infrastructure is the same as the Functions development namespace, with the addition of App Platform handling versioning, rollback, environment variables, and other processes specific to the App Platform environment.
Functions components in App Platform integrate with the rest of App Platform’s offerings, which lets you use functions to build an API that powers the rest of your app’s backend alongside its static site or containerized web application.
Functions currently has five different runtimes, representing four different programming languages:
You can also view the list of supported runtimes with
doctl serverless status --languages.
DigitalOcean Functions have built-in insights, including activation rate, average duration, average wait time, and error rate over the last 14 days. Functions also has 3 days of log retention.