Examples
boto3 (Python)
Connect boto3 to RustFS and perform basic object operations from Python.
boto3 is the AWS SDK for Python and connects to RustFS through a custom endpoint.
Install
pip install boto3Configure
Point the client at your RustFS endpoint. Replace http://localhost:9000 with your server address, and use your own access keys. RustFS requires path-style addressing, set via botocore Config:
import boto3
from botocore.config import Config
s3 = boto3.client(
"s3",
endpoint_url="http://localhost:9000",
aws_access_key_id="<your-access-key>",
aws_secret_access_key="<your-secret-key>",
region_name="us-east-1",
config=Config(s3={"addressing_style": "path"}),
)Verify
Create a bucket, upload a file, and list the bucket:
s3.create_bucket(Bucket="my-bucket")
s3.upload_file("/path/to/hello.txt", "my-bucket", "hello.txt")
for obj in s3.list_objects_v2(Bucket="my-bucket").get("Contents", []):
print(obj["Key"], obj["Size"])Expected output:
hello.txt 12Next steps
See the S3 SDK overview for more languages, or manage objects with mc.