Compute@Edge services

Compute@Edge is a computation platform capable of running custom binaries that you compile on your own systems and upload to Fastly. Security and portability is provided by compiling your code to WebAssembly, which we run at the edge using Lucet, an open-source WebAssembly runtime created by Fastly.

WARNING: Compute@Edge is in limited availability, but the status of individual language support varies. Our support for Rust is also limited availability. AssemblyScript and JavaScript support are currently in beta. For more information, see our product and feature lifecycle descriptions.

Getting started

Start a Compute@Edge free trial

Even if your Fastly account is not already enabled for Compute@Edge, you can start a Compute@Edge free trial.

  1. Log in or create a new Fastly account.
  2. In the Compute section, click "Create Compute Service" and follow the prompts.

While on a free trial, Compute@Edge services in your account are subject to lower limits and cannot be used for production traffic. When you're ready to use your Compute@Edge service for production traffic, contact our sales team or your Fastly account contact.

Generate an API token

Compute@Edge services use packages built on your computer using the Fastly CLI. To authenticate the Fastly CLI, you must create an API token for your account. Follow the steps for creating an API token, make sure it has global scope, and make a note of the token.

Download and install the Fastly CLI

The Fastly 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. Visit the GitHub repo to download the package for your distro.

Verify everything works by running fastly version. For example:

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

The CLI will notify you if a new version is available. You can update it using the fastly update command.

Configure the Fastly CLI

The CLI interacts with Fastly via our API, authenticated using an API token. Configure the CLI to act on your behalf using the token you previously created. 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.

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

Choose a language to use

Fastly supports client SDKs for several languages that can compile to Compute@Edge compatible Wasm packages. Choose a language below to view language-specific guidelines for using its SDK.

Beta SDKs are not intended for production use and may change extensively as we iterate on customer feedback. We provide customers who participate in our Beta program the opportunity to test, validate, and provide feedback on future functionality. In Limited Availability, an SDK is suitable for production use with a limited number of customers. Reference documentation is complete but supporting tutorials and code examples may be lacking. In General Availability, an SDK is available for everyone to use, and is supported by extensive up to date references, examples, and tutorials.

While we recommend the use of official Fastly SDKs, you can also create your own for a language of your choice, or use a community-created SDK. Learn more about custom SDKs

Install local dependencies

To build your project, the Fastly CLI requires your local toolchain to be available and up to date. To install the toolchain for your chosen language, follow these instructions:

  1. Rust
  2. AssemblyScript
  3. JavaScript

Compiling Rust applications for Compute@Edge requires that you have rustup installed, along with Rust's stable channel and the wasm32-wasi toolchain. Install Rust and its dependencies using rustup so you can begin building Compute@Edge services:

If you don't have rustup installed:

Download and install rustup and the Rust stable toolchain:

$ curl --proto '=https' --tlsv1.2 -sSf | sh -s -- -y --default-toolchain stable

Install the wasm32-wasi target for the stable toolchain:

$ rustup target add wasm32-wasi --toolchain stable

If you do have rustup installed:

Install Rust:

$ rustup toolchain add stable

Install the wasm32-wasi target for the stable toolchain:

$ rustup target add wasm32-wasi --toolchain stable

Create a new Compute@Edge project

Use fastly compute init to scaffold a new Fastly Compute@Edge project. The CLI will generate source code for your project in the current working directory.

To get you started, Fastly provides a library of Compute@Edge applications that are ready to compile and run on your service, so you can start from a working example that is as close as possible to the solution you are trying to achieve.

Right now, we offer the following starter kits:

When you initialize a Compute@Edge project with fastly compute init, you'll be prompted to choose one of these starter kits.

Start the setup wizard:

$ mkdir example && cd example
$ fastly compute init

The system will display a series of prompts with which you can specify details about your service.

Creating a new Compute@Edge project.
Press ^C at any time to quit.
Name: [example]
Description: hello world rust project
Author: Service Author
[1] Rust
[2] AssemblyScript (beta)
[3] JavaScript (beta)
[4] Other ('bring your own' Wasm binary)
Choose option: [1]
Starter kit:
[1] Default starter for Rust
A basic starter kit that demonstrates routing, simple synthetic responses and
overriding caching rules.
[2] Beacon termination
Capture beacon data from the browser, divert beacon request payloads to a log
endpoint, and avoid putting load on your own infrastructure.
[3] Static content
Apply performance, security and usability upgrades to static bucket services such as
Google Cloud Storage or AWS S3.
Choose option or paste git URL: [1]

At the prompts, provide details about the service you're creating:

  • Name: Enter a name for your service. By default, the CLI will use the name of the current directory.
  • Description: Enter a short description for your service, or leave it blank.
  • Author: Enter an email address as the author of the service package if desired.
  • Language: Select the toolchain you wish to use to build your service.
  • Starter kit: Choose from the available starter kits or press enter to accept the default. You may also enter the URL of a GitHub repo to use a template not in the list.

The CLI will set up a local development environment and a fastly.toml package manifest based on your selections, and provide some useful links and commands for working with your project:

✓ Initializing...
✓ Fetching package template...
✓ Updating package manifest...
✓ Initializing package...
Initialized package example to:
To publish the package (build and deploy), run:
fastly compute publish
To learn about deploying Compute@Edge projects using third-party orchestration tools, visit:
SUCCESS: Initialized package example

NOTE: Prior to CLI version 0.28.0 the compute init process prompted for the domain and backend, and created a live Fastly service in preparation for your first deployment. This has now been moved to the compute deploy process.

By default fastly compute init will create your project in the current directory. To specify a different one, use the --directory flag, but remember to change to the target directory before executing any other fastly commands that you want to run in the context of the new project.

Compile the project to a Wasm binary

HINT: If you want to dive right in to the code, check out the language-specific guides on Rust, AssemblyScript or JavaScript.

After editing the source code, you'll compile it into a WebAssembly module that can be packaged for Fastly use. The Fastly CLI internally runs your language's compiler and generates the necessary WebAssembly binary.

$ fastly compute build

A successful build looks like this:

$ fastly compute build
✓ Initializing...
✓ Verifying package manifest...
✓ Verifying local <selected language> toolchain...
✓ Building package using <selected language> toolchain...
✓ Creating package archive...
SUCCESS: Built <selected language> package <name> (pkg/<name>.tar.gz)

During the limited availability phase of Compute@Edge, we require that your toolchain is up to date to build a package, so you may see a warning if you need to update before you can build.

Deploy the project to a new Fastly service

Once you’re happy with your code and want to deploy the project to Fastly, run fastly compute deploy.

You will need a live Fastly service running on our Compute@Edge platform to which your package will be deployed. If you have one you want to use, you can add the service ID into the service_id property in your fastly.toml before running the deploy command, but if not, we'll create a service for you automatically.

At the prompts, provide details about the service you're creating:

  • Domain: Press enter to accept the automatically generated domain name (we'll take care of the TLS and DNS and give you a working domain immediately) or enter the name of the domain you'd like to associate with your service. You can also accept the default now and add more domains to the service later if you prefer.
  • Backend: If you want to configure an origin server for your service, enter a valid hostname, or an IPv4 or IPv6 address. Alternatively leave the prompt blank to create a service with no origin server. Such services cannot forward requests to your servers, but they can respond to client requests with a response composed within your Compute@Edge package.

NOTE: Find out more about routing traffic to Fastly.

Currently, it is not possible for Fastly services to have no backend, so if you leave the backend prompt blank, a backend with address will be added to the service. This backend will not accept traffic and can be deleted if you add a real origin server later.

$ fastly compute deploy
There is no Fastly service associated with this package. To connect to an existing service
add the Service ID to the fastly.toml file, otherwise follow the prompts to create a
service now.
Press ^C at any time to quit.
Create new service: [y/N] y
✓ Initializing...
✓ Creating service...
Domain: []
Backend (hostname or IP address, or leave blank to stop adding backends):
✓ Initializing...
✓ Creating domain ''...
✓ Uploading package...
✓ Activating version...
Manage this service at:
View this service at:
SUCCESS: Deployed package (service PS1Z4isxPaoZGVKVdv0eY, version 1)

The output includes a link to manage your service in the Fastly web interface. You can use this link to perform more complex configuration of the service, such as adding or removing domains, changing origin server settings, and setting up logging endpoints.

HINT: Many customers like using Terraform to manage Fastly service configurations. If you want to do this, consider using Terraform to provision the service, and then add the service_id to the fastly.toml file.

After the command completes, it may take up to an additional 20 seconds before the package begins handling requests, and any previous version of the package may continue to handle requests for up to a minute (there will be no previous version on your first deploy).

Test and celebrate

Open a browser or use a command line HTTP client such as cURL to issue a request to the domain that you assigned to the service.

$ curl -si ""
HTTP/2 200
content-type: text/html; charset=utf-8
date: Tue, 09 Nov 2021 17:25:05 GMT
content-length: 666
<!DOCTYPE html>
<html lang="en">

Or if you prefer, test it in a web browser:

Compute@Edge welcome content

Next steps

Now that you have a working project deployed, you have the basic building blocks in place to be successful with Compute@Edge.

If you would like to learn more about how Compute@Edge integrates with your preferred language, read our getting started guides for Rust, AssemblyScript or JavaScript.

If you are already familiar with VCL and want to migrate an existing VCL configuration to Compute@Edge, try the VCL to Compute@Edge migration guide, which shows examples of the most common use cases in VCL and how to implement the same functionality using Compute@Edge's supported languages.

Or maybe you have an idea in mind and you want to experiment with examples? Try cloning a starter kit, copy and pasting code from some examples, or following a tutorial.

Limitations and constraints

Compute@Edge services allow connections to backends on ports 80 and 443, and accept client connections on port 443 only. This is different from VCL services, which support client connections on port 80.

HINT: If your Compute@Edge service receives a request on port 80, Fastly automatically returns a 308 ("Permanent Redirect") response status with the Location header indicating the HTTPS version of the same URL in a Location header.

The following default limits apply to Compute@Edge services. If you need to exceed one of these limits, please speak to your Fastly contact or reach out to

Maximum compiled package size50MBper service
Maximum CPU time available to a single request instance50msper execution
Maximum runtime for a single request instance2 min
(60s for free trials)
per execution
Maximum memory consumption1M bytes stack, 128MB heap
(Heap is limited to 64MB for free trials)
per execution
Maximum number of dictionary lookups16per execution
Maximum number of backend requests32per execution

An 'execution' refers to a single instance of Compute@Edge being executed, normally in response to a client HTTP request. Separate limits also apply to the use of log tailing with Compute@Edge services.


As an early customer, your feedback is invaluable to us and will help shape the future of Compute@Edge. We'd really appreciate any and all feedback on your experience, but especially any experiences related to:

  • problems you had with the onboarding process.
  • problems you had with the tools: the Fastly CLI or our Rust crates.
  • problems you have with the programming model or the architecture of your application
  • things that you haven’t been able to do, especially those you were expecting to but couldn’t.

Please be aware that not all features available within VCL services are yet available in Compute@Edge.

If you aren't sure where to provide feedback, your Fastly account contact can help or you can contact