Skip to main content
Beam allows you to create highly-available storage volumes that can be used across tasks. You might use volumes for things like storing model weights or large datasets.
Beam Volumes are mounted into containers and provide a shared filesystem interface for datasets, model caches, and outputs. Choose a durable disk for single-writer database state, or a cloud bucket for storage you already manage.

How to Write Files in Beam Containers

There are two use-cases for saving files: persistent files, that you want to access between tasks, and temporary files that will be deleted when your container spins down.
  1. Persisting Files: write to a volume.
  2. Temporary Files: temporary files can be written to the /tmp directory in your Beam container, for example you could save an image to /tmp/myimage.png.

Reading and Writing to Volumes

You can read and write to your Volume like any ordinary Python file:
Changes to a volume may take time to appear in other containers.
Running a database or another service where a single process owns its data? A durable disk gives one container fast, node-local storage that persists across restarts.
To run this code, run python [filename].py. You’ll see it print the text we just wrote to the file.

Creating a Volume

Volumes can be attached anything you run on Beam.
By default, Volumes are scoped to a workspace and can be shared by its apps.
If you add a volume to your app, it will be created automatically. You can also create volumes manually in the CLI, by using:

Uploading Data

You can upload files with the CLI using the beam cp command.

Files

Directories

Downloading Data

Files

Directories

CLI Management Commands

Create a Volume

Delete a Volume

List Volumes

List Volume Contents

Copy Files to Volumes

Move Files in Volumes

Remove Files from Volumes