Magic Cache
Magic Cache transparently swaps the GitHub Actions cache backend to a fast, unlimited S3 cache inside your own VPC — same actions/cache config, nothing leaves your account.
RunsOn Magic Cache transparently switches the GitHub Actions caching backend to a fast, unlimited S3 cache in your own VPC — so you keep using actions/cache (and language-specific cache actions) completely unchanged.
How it works
With the Magic Cache enabled, the RunsOn agent starts a sidecar cache backend on the runner and points the caching actions — including the gha backend for Docker Buildx — at it.
The sidecar transparently forwards every request to an S3 cache bucket in your own VPC and streams hits straight back. Same actions/cache config, nothing leaves your account, and there’s no 10 GB cap.
Because only the storage backend changes, the exact same workflow keeps working when you fall back to GitHub-hosted runners — the cache just points at GitHub’s backend instead.
If the sidecar fails to start (5s timeout), the job falls back to GitHub’s standard cache backend and emits a warning annotation — the job is not failed.
Enabling it
The Magic Cache is opt-in. Flip it on per job (Flex) or bake it into a runner fleet (Fleet):
- Flex — add the
extras=s3-cachejob label and theruns-on/action@v2↗ step. The choice lives with the workflow author. - Fleet — publish cache-enabled runners from Terraform (
extras = ["s3-cache"]). The choice lives with the platform team.
| Aspect | Flex | Fleet |
|---|---|---|
| Who chooses | Workflow author, per job | Platform team, in Terraform |
| Where it lives | extras=… label or .github/runs-on.yml | runners.<name>.extras in Terraform |
| Magic Cache (S3) | ✓ | ✓ |
| Docker BuildKit S3 | ✓ | ✓ |
| Ephemeral registry | ✓ | — |
The detailed guides below have copy-paste examples for both models.
Retention
Cached objects are evicted on a retention window (default 10 days). For Fleet and Flex, the Terraform module provisions the bucket and exposes the window:
cache_expiration_days = 10Use a longer window for slow-changing dependency caches, and a shorter one for high-churn branches or very large artifacts.
Scope
Detailed guides
Other ways to cache
The Magic Cache covers actions/cache and Docker layers. For caches tied to the runner’s disk rather than an S3 backend, see the runner capabilities:
- Sticky disks (EBS) — fastest for large Docker layer sets (skips export and compression), but adds EBS storage cost and is less portable.
- Shared volumes (EFS) — large shared datasets, monorepo mirrors, or dependency stores that should behave like a mounted disk.
- YOLO mode (tmpfs) — hot temporary directories that fit in memory. Not for caches that must survive the runner.
- Custom images — better than a cache when the input changes slowly. Bake the SDK or base layer into the AMI.