🇺🇸 English | 🇷🇺 Русский
Prefixload is a small command-line utility written in Rust that periodically uploads files from a local directory to an Amazon S3 or S3-compatible bucket. It selects files for upload based on configurable filename prefixes.
This tool is useful for automating backups where files are organized and named with consistent prefixes (e.g., db_backup_2025-09-21.sql, logs_myapp_2025-09-21.tar.gz).
- Prefix-based Rules: Configure rules in a YAML file to map file prefixes to specific remote directories in your S3 bucket.
- S3-Compatible: Works with AWS S3 as well as other S3-compatible services like MinIO, Ceph, or Wasabi.
- Efficient Syncing: Uses S3 ETags to check if a file is already synced, avoiding unnecessary re-uploads.
- Multipart Uploads: Automatically handles large files using multipart uploads.
- Secure Credential Storage: A
logincommand helps you securely store your AWS credentials.
You can install Prefixload directly from crates.io using Cargo:
cargo install prefixloadThe tool requires a one-time setup for credentials and configuration.
First, configure your AWS credentials. The tool will prompt you for your Access Key ID and Secret Access Key and save them to the standard ~/.aws/credentials file.
prefixload loginNext, set up your backup rules. The configuration is stored in a YAML file. To open it in your default editor, run:
prefixload config editThis will open the configuration file where you can define your S3 endpoint, bucket, and prefix mapping rules.
To perform a one-time backup based on your configuration, use the run command:
prefixload runYou can run it in quiet mode to suppress output and log to a file instead:
prefixload run --quietThe configuration is located at ~/.config/prefixload/config.yml (on Linux/macOS) or %APPDATA%\prefixload\config.yml (on Windows).
Here is an example of the config.yml file:
# The endpoint URL of your S3-compatible storage
endpoint: "https://s3.example.com"
# The name of your S3 bucket to upload files to
bucket: "my-backup-bucket"
# The AWS region. Required by the SDK.
region: "us-east-1"
# Set to `true` for S3-compatible services that require path-style addressing (e.g., MinIO).
force_path_style: false
# The upload part size in bytes for multipart uploads (e.g., 15MB).
part_size: 15728640
# Path to the local directory where your files are stored.
local_directory_path: "/var/backups"
# Mapping rules for uploading files.
directory_struct:
# Files starting with "db_backup_" will be uploaded to the "database/" directory in the bucket.
- local_name_prefix: "db_backup_"
remote_path: "database/"
# Files starting with "app_logs_" will be uploaded to the "application_logs/" directory.
- local_name_prefix: "app_logs_"
remote_path: "application_logs/"