Use your existing S3 tools

A drive is a bucket. Point aws, boto3, the AWS SDK for JavaScript or rclone at Side Space with three settings and a key, and every write becomes a version.

這一頁還沒有翻譯,所以先以英文顯示。

A drive is a bucket and a path is a key, so the S3 tools you already use work against Side Space with nothing extra installed. Start with them, and reach for an SDK only for what S3 can't say, such as changing a few bytes in place or forking a drive.

Every example on this page was run against a Side Space server with aws-cli 1.46 and 2.40, boto3 1.43, the AWS SDK for JavaScript v3, and rclone 1.60 and 1.68. The repository's tests/e2e/vs-bucket.sh checks aws and rclone again on every run, and also measures the gateway against a plain bucket (results).

The settings

SettingValue
Endpointhttps://s3.side.space (on your own server: port 8070 of its domain, or the S3 domain you set up)
RegionAnything; us-east-1 is a safe choice
AddressingPath-style (force_path_style, forcePathStyle)
CredentialsAn access key id and secret from side token create … --s3

Make a key that can reach only what the tool needs:

Shell
side token create rclone --scope files:write --s3
# aws_access_key_id = SSAK6ZHDUDEXTQGPJ247
# aws_secret_access_key = ssp_…   (also an ordinary Side Space token)

The bucket for a drive is its name in lower case with other characters turned into -: Film A is film-a.

aws cli

Shell
export AWS_ACCESS_KEY_ID=SSAK6ZHDUDEXTQGPJ247 AWS_SECRET_ACCESS_KEY=ssp_…
export AWS_ENDPOINT_URL=https://s3.side.space AWS_DEFAULT_REGION=us-east-1

aws s3 ls                                          # the drive this key is for
aws s3 cp ./Ep01 s3://film-a/Ep01 --recursive      # upload a folder
aws s3 sync ./Ep01 s3://film-a/Ep01                # only what changed

# Every write is a version
aws s3api get-bucket-versioning --bucket film-a    # "Status": "Enabled"
aws s3api list-object-versions --bucket film-a --prefix Ep01/script.md
aws s3api get-object --bucket film-a --key Ep01/script.md --version-id ver_01M7… old.md

# Bring an old version back: copy it onto its own key
aws s3api copy-object --bucket film-a --key Ep01/script.md \
  --copy-source "film-a/Ep01/script.md?versionId=ver_01M7…"

# Read just a range of a big file
aws s3api get-object --bucket film-a --key Ep01/a.mov --range bytes=0-65535 head.bin

Older aws-cli versions don't read AWS_ENDPOINT_URL; pass --endpoint-url https://s3.side.space to each command instead.

boto3

Python
import boto3

s3 = boto3.client("s3", endpoint_url="https://s3.side.space",
                  aws_access_key_id="SSAK6ZHDUDEXTQGPJ247", aws_secret_access_key="ssp_…",
                  region_name="us-east-1")

r = s3.put_object(Bucket="film-a", Key="Ep02/notes.md", Body=b"# Notes\nPick-ups Tuesday.\n")
print(r["VersionId"])                                   # ver_…

head = s3.get_object(Bucket="film-a", Key="Ep01/a.mov", Range="bytes=0-65535")
versions = s3.list_object_versions(Bucket="film-a", Prefix="Ep02/notes.md")["Versions"]
first = s3.get_object(Bucket="film-a", Key="Ep02/notes.md", VersionId=versions[-1]["VersionId"])

# Write only if nothing is there yet: one of two racing writers gets 412
s3.put_object(Bucket="film-a", Key="Ep02/claim.txt", Body=b"me", IfNoneMatch="*")

url = s3.generate_presigned_url("get_object", Params={"Bucket": "film-a", "Key": "Ep02/notes.md"}, ExpiresIn=3600)

AWS SDK for JavaScript

TypeScript
import { GetObjectCommand, ListObjectVersionsCommand, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  endpoint: "https://s3.side.space",
  region: "us-east-1",
  forcePathStyle: true,
  credentials: { accessKeyId: "SSAK6ZHDUDEXTQGPJ247", secretAccessKey: process.env.SIDESPACE_TOKEN! },
});

const put = await s3.send(new PutObjectCommand({ Bucket: "film-a", Key: "Ep02/cut.txt", Body: "v1\n" }));
console.log(put.VersionId);
const head = await s3.send(new GetObjectCommand({ Bucket: "film-a", Key: "Ep01/a.mov", Range: "bytes=0-65535" }));
const { Versions } = await s3.send(new ListObjectVersionsCommand({ Bucket: "film-a", Prefix: "Ep02/" }));

rclone

rclone reaches S3 through a remote you name in its config. The examples call it side; side:film-a is then the bucket film-a through that remote. Add it to the config file, or run rclone config create side s3 provider=Other endpoint=https://s3.side.space access_key_id=SSAK6ZHDUDEXTQGPJ247 secret_access_key=ssp_….

ini
# ~/.config/rclone/rclone.conf
[side]
type = s3
provider = Other
access_key_id = SSAK6ZHDUDEXTQGPJ247
secret_access_key = ssp_…
endpoint = https://s3.side.space
force_path_style = true
Shell
rclone lsd side:                                 # the drive this key is for
rclone copy ./Renders side:film-a/Renders        # upload
rclone check ./Renders side:film-a/Renders       # sizes match; hashes are skipped (see below)
rclone ls --s3-versions side:film-a/Renders      # old versions show as name-v<date>.ext

What works

AreaSupported
BucketsListBuckets, HeadBucket, GetBucketVersioning; CreateBucket and DeleteBucket with an admin key (see S3 gateway)
ListingListObjects v1 and v2 and ListObjectVersions, with prefix, delimiter and paging
ReadsGetObject and HeadObject with a byte range, versionId and presigned URLs (SigV4 and SigV2)
WritesPutObject and CopyObject with If-Match, If-None-Match: * and x-sidespace-if-version; aws-chunked streaming uploads
MultipartCreate, UploadPart, Complete, Abort, ListParts, ListMultipartUploads; no 5 MB minimum part size; completing makes one version
DeletesDeleteObject and DeleteObjects move files to the trash for 30 days
HistoryVersions, delete markers and x-sidespace-as-of to read a bucket as it was (History and rewind)

Differences to know

  • ETags are not MD5 sums. They change when the content changes and work with If-Match, but they aren't the MD5 of the bytes. aws and rclone don't trip over this (rclone reports "hashes could not be checked" and compares sizes); tools that insist on comparing ETags with a local MD5 need that check turned off.
  • Versioning is always on. Every write is a version you can read and restore. Suspending versioning answers InvalidArgument, and deleting a single version answers MethodNotAllowed. That's why rclone purge fails on a drive: it deletes each version by id. Use rclone delete, which moves the files to the trash.
  • A delete goes to the trash. The file shows as a delete marker with the id del.<node id>; deleting the marker brings it back.
  • Folders are real. Writing Ep01/Shots/a.mov makes the folders on the way, and an empty folder stays after its last file is deleted.
  • A move is a copy and a delete. aws s3 mv and rclone moveto make a new file at the new key and trash the old one, so history starts again there. The first version at the new key has copied_from pointing at the version it came from, and the old file stays in the trash with all its history for 30 days. To move a file and keep its history, use side mv, the Finder or the API.
  • Not supported: bucket policies, ACLs and object tags.

When to use an SDK instead

Use an SDK, or plain HTTP, when S3 would make you download a whole object to change part of it. An in-place edit sends only the bytes that change, and the server stores only the chunks near them. SDKs also do what S3 has no words for: forks, rewinding a folder, sidecars and search.