CLI

fastly is an open-source command line tool for interacting with the Fastly API. Use it to create services, manage backends and domains, upload VCL or build and deploy Compute@Edge packages. Convenient access to Fastly from where you are working with your code, or from your CI environment.

$ fastly backend create --name 'app_server' --service-id abcdef1234567890
SUCCESS: Created backend app_server (service abcdef1234567890 version 1)

WARNING: This information is part of a beta release, which may be subject to breaking changes and improvements over time. For more information, see our product and feature lifecycle descriptions.

Installing

The CLI is available from familiar package registries.

  • MacOS: Install from Homebrew:
    $ brew install fastly/tap/fastly
  • Windows: Install from Scoop:
    $ scoop bucket add fastly-cli https://github.com/fastly/scoop-cli.git
    $ scoop install fastly
  • Linux: Packages are available for Debian/Ubuntu, Fedora, CentOS and SUSE, along with prebuilt binaries. Visit the GitHub repo to download the package for your distro and see installation instructions for your package manager.

Verify everything works by running fastly version. For example:

$ fastly version
Fastly CLI version vX.Y.Z (abc0001)
Built with go version go1.13.1 linux/amd64

You'll be notified if a new version is available. You can update it using the fastly update command.

Shell auto-completion

The CLI can generate completions for all commands, sub-commands and flags. To install the completions, source them in your ~/.bash_profile (or equivalent):

$ eval "$(fastly --completion-script-bash)"

Or for ZSH in your ~/.zshrc file:

$ eval "$(fastly --completion-script-zsh)"

Reload your profile (or log out and log in again), and you should be able to autocomplete fastly commands by pressing TAB. Try it by typing fastly backen⇥.

Configuring

The CLI interacts with Fastly via our API, authenticated using an API token. Configure the CLI to act on your behalf by generating a token in the web interface. Choose one of the following options to give the CLI access to your API token:

  • (Recommended) Run fastly configure and follow the interactive prompts. This will store your API token credential in a configuration file and remember it for subsequent commands.
  • Include the token explicitly on each command you run using the --token or -t flags.
  • Set a FASTLY_API_TOKEN environment variable.

If authentication credentials are defined in multiple places, they are resolved according to the following order of precedence: command-line flags (highest priority), env vars, and config file (lowest).

For an overview of all available commands, run fastly with no arguments. Succinct help about any command or subcommand is available via the --help flag (e.g., fastly service -h). For verbose help, use the help command (e.g., fastly help service).

Command groups