Fastly Guide (Unofficial)
This is an unofficial companion guide to using Fastly Compute@Edge.
It builds on the official Fastly documentation with an additional focus on:
- Quick Start Guides to get a "Hello World" app working quickly
- Day 2 usage to make everything as programmable as possible for creating services, packaging, uploading and activation.
- Management Console usage for various operations including creating services, uploading packages, and activating services.
What is Compute@Edge?
Compute@Edge lets you deploy lightweight, fastly to run, serverless code at the edge, in the form of WebAssembly (Wasm) packages. The WASM packages are standard definition files that use the WebAssembly System Interface (WASI).
See more on the Fastly Product page and this guide's FAQ.
Deployment Process
There are generally 5 steps for deploying code at Fastly's Edge, some of which can be combined and reordered by some tools such as the Fastly CLI.
- Create the
fastly.toml
file - Create the WASM binary
- Create the Edge Code package tarball
- Upload the Edge Code package tarball
- Activate the service
Prerequisites include:
- Create an account
- Create a Compute@Edge service
- Add a domain
- Add TLS certificate, which is required for Compute@Edge
Note: Compute@Edge requires TLS for connections. Free TLS is provided for Fastly subdomains, but a paid account is required to use your own domain.
Edge Code Language Support
Code can target WebAssembly in a variety of languages. The following are available with support from Fastly and the community.
- JavaScript (Fastly): reference, NPM
- AssemblyScript (Fastly): reference, NPM
- Rust (Fastly): reference
- Swift (community): repo
- Zig (community): repo
Fastly's support team offers support on Fastly SDKs, while community projects are supported by their author's and the community. See the community SDKs page for general info on how to use these.
For a discussion on new language support, including Go, check out the article on Evaluating new languages for Compute@Edge.
Deployment Options
Fastly offers several ways to deploy Fastly edge code packages to production.
- Fastly CLI - an easy way to create and upload packages manually
- Fastly Management Console - upload packages via drag-and-drop from your filesystem
- Fastly API - upload packages via Fastly's "Upload a Compute@Edge package" API
- Fastly API Client SDK for Go - upload packages via the
UpdatePackage
function - Fastly API Client SDK for JavaScript - upload packages via the
putPackage
function - Fastly API Client SDK for PHP - upload packages via the
putPackage
function
See the Deployment page for more information on these approaches. The Packaging page covers the service package file format, along with approaches to create the service package.
Fastly also provides API Client SDKs in Python, Ruby, and Perl. To request Upload Package API support, please post a GitHub Issue for their respective GitHub repositories.
Local testing can be done using Viceroy.