CLI reference

Every command accepts --help. A left-out tunnel name means the current tunnel.

cloudify [--version] [-p PORT] [-ssh host|remote]
         setup | quickstart | serve | tunnel | route | account | replica | temp | cloudflared | ssh

Top-level options#

Command What it does
cloudify -p 3000 Temporary public URL for localhost:3000 until Ctrl+C. No account needed.
cloudify -ssh host Share this machine's shell.
cloudify -ssh remote Connect to a shared shell.
cloudify --version Show the version.

Setup#

Command What it does
cloudify setup --domain example.com Connect a Cloudflare domain through an authorization link.
cloudify quickstart [NAME] Wizard: tunnel name, auto-start, first route.
cloudify serve Start the dashboard and API.

cloudify serve#

Option What it does
--serve-port 8765 Port.
--host ADDR Listen address. Default 0.0.0.0.
--secure Listen on 127.0.0.1 unless --host is given. Answer only to known names.
--allowed-host NAME Secure mode: extra name or pattern ('*.trycloudflare.com').
--insecure-http Secure mode: allow plain HTTP on a network --host.
--ssl-certfile, --ssl-keyfile Serve HTTPS.
--api-docs Enable /api/docs.

By default the dashboard is open to the network over plain HTTP. See Security.

While no account exists, serve prints the one-time setup code.

cloudify tunnel#

Command What it does
tunnel create [NAME] [--no-autostart] [-a ACCOUNT] Create a tunnel with auto-start. -a: account ID or one of its domains. Names: letters, digits, -, _, ., up to 63 characters.
tunnel list Managed tunnels, plus other tunnels of the connected accounts.
tunnel status [NAME] Process, connections, routes.
tunnel start [NAME] / tunnel stop [NAME] Start or stop it.
tunnel use NAME Set the current tunnel.
tunnel autostart [NAME] --enable / --disable / --status Manage starting at boot.
tunnel adopt NAME Manage a tunnel created outside Cloudify.
tunnel delete [NAME] [--force] Delete it locally and in Cloudflare. Refuses while replicas are attached.
tunnel resume Start every auto-start tunnel.

cloudify route#

Command What it does
route add DOMAIN PORT [-t TUNNEL] [--service HOST] Publish https://DOMAIN to http://HOST:PORT. HOST defaults to localhost.
route edit DOMAIN [-t TUNNEL] [--hostname NEW] [--service HOST] [--port N] Change hostname, service host or port.
route remove DOMAIN [-t TUNNEL] Remove the route.
route list [-t TUNNEL] Show the routes.
route check [-t TUNNEL] Check every route's DNS record.
route repair DOMAIN [-t TUNNEL] [--overwrite] Recreate a missing DNS record. --overwrite re-points an existing one.

add, edit and remove restart a running tunnel.

cloudify route add app.example.com 3000 -t web
cloudify route add api.example.com 8080 -t web --service my-api        # a container on the same network
cloudify route add '*.dev.example.com' 8000 -t web                    # wildcard (quote it for the shell)
cloudify route edit app.example.com --port 3001
cloudify route edit app.example.com --hostname www.example.com

cloudify account#

Command What it does
account connect DOMAIN Authorize another domain.
account list Connected domains with connection and account IDs.
account token CONNECTION_ID [--remove] Store or forget a Zone · DNS · Edit API token for DNS cleanup.
account domain CONNECTION_ID DOMAIN Name the domain of an older default connection.
account remove CONNECTION_ID Disconnect a domain. Tunnels keep running.

cloudify replica#

Command What it does
replica export OUTPUT -t TUNNEL [-t ...] [--passphrase P] Write an encrypted file for running these tunnels elsewhere.
replica import FILE [--passphrase P] [--no-autostart] Run the tunnels from that file.
replica plan [-t TUNNEL] [-H HOSTNAME] Show what replicating involves.
replica split TUNNEL HOSTNAMES... --name NEW Move hostnames into a new tunnel.

Type the passphrase at the prompt. --passphrase ends up in your shell history.

cloudify temp#

Command What it does
temp create PORT Same as cloudify -p PORT.
temp list List temporary tunnels.
temp stop [URL] Stop one, or all.

cloudify cloudflared#

Command What it does
cloudflared version Installed and latest version.
cloudflared update Update cloudflared.

cloudify ssh#

Same as cloudify -ssh. See SSH sharing.

Command What it does
ssh host [--ttl MIN] [--once] [--save-code FILE] Share this shell. --ttl: default 60, max 1440 minutes. --once: stop after the first session.
ssh remote [--code CODE \| --code-file FILE] [--password PW] [--sftp] [-- COMMAND] Connect. --sftp: file transfer. -- uptime: run one command.

Environment variables#

Variable Used by Purpose
CLOUDIFY_SSH_PASSWORD ssh remote Password for scripts.
CLOUDIFY_SETUP_CODE serve Fixed setup code. Use a long random value.
CLOUDIFY_SECURE=1 serve Same as --secure.
CLOUDIFY_ALLOWED_HOSTS serve Same as --allowed-host, comma-separated.
CLOUDIFY_INSECURE_HTTP=1 serve Same as --insecure-http.
CLOUDIFY_API_DOCS=1 serve Same as --api-docs.
CLOUDIFY_SERVE_ARGS Docker image Extra serve options. See Docker.
HOME everything Data lives in $HOME/.cloudflared. See Files and data.

Exit codes#

0 success, 1 failure, 2 invalid usage.