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

Metadata collection

Fastly collects metadata about the Compute programs that you compile using the CLI, in accordance with our data processing and privacy policies. This is what we collect:

  • Build information : Information regarding the time taken for builds and compilation processes that helps us identify bottlenecks and optimize performance.
  • Packages used in source : The list of packages imported in your source code, enabling us to prioritize support and compatibility testing for the most commonly used third party components.
  • Machine information (requires explicit opt-in): General, non-identifying system specifications (CPU, RAM, operating system) to better understand the hardware landscape our CLI operates in.
  • Script information : Customization options for the CLI build step. See Scripts for reference.

Build, package and script information is collected by default. You'll need to explicitly opt-in to send machine information.

The preferences are recorded in the CLI's internal configuration file, which can be viewed by running fastly config. Here is an example of a CLI configuration that sets data-collection preferences:

build_info = "[enable|disable]"
machine_info = "[enable|disable]"
package_info = "[enable|disable]"
script_info = "[enable|disable]"

You can selectively enable and disable metadata collection:

# Disable metadata collection on a per-command basis (i.e. disable for this invocation only).
$ fastly compute [build|hash-files|publish|serve] --metadata-disable
# Permanently disable metadata collection.
$ fastly compute metadata --disable
# Permanently enable metadata collection.
$ fastly compute metadata --enable
# Selectively enable or disable certain categories.
$ fastly compute metadata [--enable-build|--disable-build]
$ fastly compute metadata [--enable-machine|--disable-machine]
$ fastly compute metadata [--enable-package|--disable-package]
$ fastly compute metadata [--enable-script|--disable-script]

You can also enable or disable all metadata collection using environment variables, which can be particularly useful when running the CLI in an unsupervised environment such as a CI/CD pipeline.


To see what metadata is being collected, run the following command. This data will not be sent to Fastly unless you deploy your Compute service.

$ fastly compute build --metadata-show