s3fs for S3/R2 or gcsfuse for Google Cloud Storage.
This guide requires the FUSE-enabled kernel lane. See Choose a per-template kernel for the current private-beta kernel selection status.
S3 or R2
Google Cloud Storage
apt-get install gcsfuse.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Mount cloud buckets inside machines with FUSE-based tools.
s3fs for S3/R2 or gcsfuse for Google Cloud Storage.
This guide requires the FUSE-enabled kernel lane. See Choose a per-template kernel for the current private-beta kernel selection status.
from nullspace import Machine
machine = Machine.create(
template="my-s3fs-template",
envs={
"S3_BUCKET": "my-bucket",
"AWS_ACCESS_KEY_ID": "AKIA...",
"AWS_SECRET_ACCESS_KEY": "...",
"S3_ENDPOINT": "https://ACCOUNT_ID.r2.cloudflarestorage.com",
"S3_MOUNT_PATH": "/mnt/bucket",
},
)
try:
print(machine.commands.run("ls /mnt/bucket", shell=True).stdout)
finally:
machine.kill()
from nullspace import Template
builder = (
Template.from_ubuntu_image("22.04")
.apt_install(["fuse", "s3fs", "ca-certificates"])
.run_cmd("mkdir -p /mnt/bucket")
)
from nullspace import Machine
with open("service-account.json", encoding="utf-8") as handle:
key_json = handle.read()
machine = Machine.create(
template="my-gcsfuse-template",
envs={
"GCS_BUCKET": "my-bucket",
"GOOGLE_APPLICATION_CREDENTIALS_JSON": key_json,
"GCS_MOUNT_PATH": "/mnt/gcs",
},
)
try:
print(machine.commands.run("ls /mnt/gcs", shell=True).stdout)
finally:
machine.kill()
apt-get install gcsfuse.
machine.files.write("/root/.passwd-s3fs", "ACCESS_KEY:SECRET_KEY")
machine.commands.run("chmod 600 /root/.passwd-s3fs", shell=True)
machine.commands.run(
"mkdir -p /mnt/r2 && "
"s3fs my-r2-bucket /mnt/r2 "
"-o passwd_file=/root/.passwd-s3fs "
"-o url=https://ACCOUNT_ID.r2.cloudflarestorage.com "
"-o use_path_request_style",
shell=True,
)