Create and manage Fastly resources with the Fastly 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 --address --service-id abcdef1234567890 --version latest
SUCCESS: Created backend app_server (service abcdef1234567890 version 1)


The CLI is available for multiple operating systems.

  • MacOS: Install from Homebrew:
    $ brew install fastly/tap/fastly
  • Windows: Visit the GitHub repo to download the prebuilt binary for your architecture.
  • Linux: Packages are available for Debian/Ubuntu, Fedora, CentOS, and SUSE, along with prebuilt binaries:
    • Debian/Ubuntu Linux
      1. Download the .deb file from the releases page
      2. Run sudo apt install ./fastly_*_linux_amd64.deb to install the downloaded file
    • Fedora Linux
      1. Download the .rpm file from the releases page
      2. Run sudo dnf install fastly_*_linux_amd64.rpm to install the downloaded file
    • CentOS Linux
      1. Download the .rpm file from the releases page
      2. Run sudo yum localinstall fastly_*_linux_amd64.rpm to install the downloaded file
    • openSUSE/SUSE Linux
      1. Download the .rpm file from the releases page
      2. Run sudo zypper in fastly_*_linux_amd64.rpm to install the downloaded file
    • From a prebuilt binary: Download the latest release from the releases page. Un-archive the binary and place it in your $PATH. You can verify the integrity of the binary using the SHA256 checksums file fastly_x.x.x_SHA256SUMS provided alongside the release.

Verify everything works by running fastly version. For example:

$ fastly version
Fastly CLI version vX.Y.Z (abc0001)
Built with go version go1.18 linux/amd64
Viceroy version: viceroy X.Y.Z

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


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, then choose one of the following options to give the CLI access to your API token:

  • (Recommended) Run fastly profile create 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), environment variables, 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 --help). For verbose help, use the help command (e.g., fastly help service).


For a full list of commands available in the Fastly CLI, run fastly help or see the CLI command reference.

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⇥.