drift Docs
Start
What is Drift?
The tour, if you are new here.
Why Drift?
The case for a smaller cloud.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, five unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Accounts, tokens and scopes.
Security
Boundaries, sandboxing and hardening.

Atomic functions

The atomic section sets the function runtime limits. You usually don't list functions at all: drop your handlers into atomic/ as flat source files and the CLI auto-discovers every @atomic function (that flat set is the default element, one language, one backend). A function's URL, method, and authentication come from a one-line directive at the top of its source, never from here:

# @atomic http=post:submit auth=none           # an HTTP endpoint
# @atomic http=get:status/:token auth=none     # with a path parameter
# @atomic queue=validate auth=none             # triggered by a queue message

The limits below apply to every function in the slice. There is no per-function override.

TypeDefaultMeaning
  • function_memory
    Type
    size (MB/GB)
    Default
    32MB
    Meaning
    Max memory per invocation; exceed it and the invocation is OOM-killed. Bounded to 32MB–256MB, and the resolved value is what you're billed.
  • atomic_size
    Type
    size (KB/MB/GB)
    Default
    platform default
    Meaning
    Total disk across all deployed functions: their code and the dependencies they vendor, which in practice is your dependency tree. A deploy that would exceed it is refused. Billed as the Atomic storage line.
  • function_timeout
    Type
    duration (s/m/h)
    Default
    platform default
    Meaning
    Max wall-clock time per invocation before it's killed.
  • rate_limit
    Type
    rate (N/s, N/min, N/h)
    Default
    platform default
    Meaning
    Max invocations across the whole slice per window. Excess requests get 429.
  • deploy_history
    Type
    integer
    Default
    platform default
    Meaning
    How many past deploys are kept per function for rollback (drift atomic rollback). Higher means more restore points, more storage.
  • egress
    Type
    map
    Default
    { mode: open }
    Meaning
    Outbound network posture; see Outbound egress.
  • functions[]
    Type
    string | map (optional)
    Default
    auto-discovered
    Meaning
    Usually omitted, because functions are discovered from your flat atomic/* source. Long form adds a directory, an element, a schedule, or alerts; see below.

function_memory is bounded, not free-form.

A value outside 32MB–256MB is refused at create and at resize with function_memory must be between 32MB and 256MB. The ceiling is not a runtime limit in disguise: a compiled language's own startup floor is a platform-owned allowance added underneath, never billed, so the number here is your function's working set and nothing else.

The functions[] long form

A bare string is a function name. The map form carries four more keys, and two of them, cron and alerts, are the only way to put a function on a schedule or under an alert from the manifest.

TypeDefaultMeaning
  • name
    Type
    string
    Default
    required
    Meaning
    The function name. Standard identifier shape.
  • dir
    Type
    path
    Default
    ./atomic/<name>
    Meaning
    Source directory, relative to the Driftfile.
  • element
    Type
    string
    Default
    the flat element
    Meaning
    The sub-app this function belongs to: the group that shares one language, one dependency manifest, one runtime.
  • cron
    Type
    5-field cron
    Default
    none
    Meaning
    Run this function on a schedule. The deploy ships a schedule trigger alongside its HTTP route.
  • alerts[]
    Type
    list of maps
    Default
    none
    Meaning
    Fire a notification when this function errors. Reconciled against the live alert registry on every deploy.
Driftfile
functions:
    - nightly-digest                     # bare name, nothing special
    - name: reconcile
      element: billing                   # lives with the other billing functions
      cron: "0 3 * * *"                  # 03:00 daily, 5 POSIX fields
      alerts:
        - on: errors                     # errors is the only accepted trigger
          threshold: 5                   # errors within the window
          window: 5m                     # minimum 60s
          notify: webhook=https://hooks.example.com/drift

cron is a 5-field POSIX expression; the parser checks the field count and the scheduler validates the grammar, so a malformed expression surfaces at deploy. An alert needs window and notify, and both are errors if missing. threshold defaults to 1, on to errors, and window must be at least 60 seconds. The only notify form is webhook=<http(s) URL>.

The reconcile runs both ways: the deploy deletes any live alert the manifest does not declare, so removing an alert from the Driftfile removes it from the slice.

Outbound egress

atomic.egress declares which hosts your functions may reach. It is the source of truth for the allowlist; drift atomic egress list/refresh/test inspect what the slice has, and there is no CLI verb to add a host.

Driftfile
atomic:
    egress:
      mode: allowlist                  # open (default) | allowlist
      hosts:
        - api.stripe.com
        - "*.amazonaws.com"            # accepted, then skipped: name concrete hosts
        - smtp.sendgrid.net:587        # host:port; port defaults to 443

An allowlist is declared, not yet enforced.

The deploy prints that in as many words when it applies one. Treat the block as a statement of intended reach and keep whatever authentication and secret hygiene you would have used without it. Private ranges are a separate matter and are blocked: RFC-1918, link-local and CGNAT egress is refused from a slice whatever mode says.

Read the Atomic guide → for how to write a function.