doctl-serverless
Manage DigitalOcean serverless functions and namespaces
TLDR
Connect local serverless support to a functions namespace
Deploy a functions project to your functions namespace
Obtain metadata of a functions project
Provide information about serverless support
SYNOPSIS
doctl serverless COMMAND [ flags ]
Run 'doctl serverless help' for subcommands.
PARAMETERS
--access-token, -t
DigitalOcean API token for authentication
--context
Use specific auth context
--verbose, -v
Enable verbose logging
--trace
Enable trace logging for debugging
--help, -h
Show help
--version, -V
Show version
DESCRIPTION
doctl serverless is a subcommand of the DigitalOcean CLI tool doctl for managing serverless Functions on the DigitalOcean platform.
DigitalOcean Functions is a serverless compute service allowing developers to deploy and run code in response to events without managing infrastructure. This command enables key operations like deploying function bundles from local directories, invoking functions for testing, listing functions in namespaces, streaming real-time logs, creating/removing namespaces, and triggering HTTP invocations.
Prior to use, install doctl via package managers or binaries, then authenticate with doctl auth init --access-token YOUR_TOKEN. Functions support runtimes including Node.js, Python 3.9+, Go 1.21+, and PHP 8.1+.
Example usage:
doctl serverless deploy ./my-fn deploys to default namespace.
doctl serverless invoke default:my-fn --raw invokes and shows raw JSON output.
It integrates with Git workflows, CI/CD, and local dev servers via watchexec. Functions scale automatically, billed per invocation. Ideal for APIs, webhooks, and event-driven apps. Check DigitalOcean docs for bundle structure and limits like 100MB uncompressed size.
CAVEATS
Requires DigitalOcean account with Functions access (nyc3/iad3/sfo3 regions). Bundles must have function dir with index in supported runtime. Max 100MB unzipped, 5s init timeout.
SUBCOMMANDS
deploy: Deploy bundle.
invoke: Run function.
functions list/get/logs/rm: Manage functions.
namespace create/list/rm: Handle namespaces.
trigger http: HTTP invoke.
AUTHENTICATION
Use doctl auth init first. Personal Access Token needs read/write Functions scope.
HISTORY
Added in doctl 1.57.0 (March 2021) with Functions public beta. GA in 2022; evolved with new runtimes and HTTP triggers.


