Simple S3 utilities built with Bun, leveraging its native performance and APIs.
This package provides a lightweight CLI tool, s3cp, for uploading files to any S3-compatible storage (AWS S3, Cloudflare R2, MinIO, etc.).
All credentials and configuration are provided via environment variables:
| Variable | Description |
|---|---|
S3_ACCESS_KEY_ID |
Access key for your S3 account |
S3_SECRET_ACCESS_KEY |
Secret key for your S3 account |
S3_ENDPOINT |
S3 endpoint URL (e.g., https://example.r2.cloudflarestorage.com) |
S3_BUCKET |
Default bucket name |
S3_REGION |
(Optional) Region name (e.g., us-east-1) |
S3_SESSION_TOKEN |
(Optional) Temporary session token if using STS credentials |
Install globally with Bun:
bun add -g @amadeustech/s3This installs the s3cp binary, which you can use to copy files to S3-compatible storage.
Here’s how to upload database backups to Cloudflare R2:
#!/usr/bin/env bash
# Set S3 credentials (Cloudflare R2 example)
export S3_ACCESS_KEY_ID=foo
export S3_SECRET_ACCESS_KEY=bar
export S3_ENDPOINT=https://example.r2.cloudflarestorage.com
export S3_BUCKET=backups
# Path to the backup file
BACKUP_FILE=/var/backups/myapp/backup-2025-10-20.db.gz.gpg
# (Mock example) Create a database backup
make_db_backup -o "$BACKUP_FILE"
# Upload to /myapp/backup-2025-10-20.db.gz.gpg in the bucket
s3cp --to myapp "$BACKUP_FILE"
# Upload to /myorg/myapp/backup-2025-10-20.db.gz.gpg
s3cp --to myorg/myapp "$BACKUP_FILE"
# Upload directly to the bucket root: /backup-2025-10-20.db.gz.gpg
s3cp "$BACKUP_FILE"The --to flag specifies an object path prefix inside your bucket.
Compatible with any S3-like service (AWS, R2, MinIO, DigitalOcean Spaces, etc.).
Designed for scripts and automation (ideal for backup pipelines).
Contributions are welcome! 🎉 If you’d like to add new features, improve existing ones, or fix bugs — please open an issue or a pull request.
- Fork this repository and clone your fork locally.
- Install dependencies:
bun install- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name- Make your changes and ensure the code runs properly with Bun.
- Commit your changes with a clear message:
git commit -m "feat: add new cool stuff"- Push your branch and open a Pull Request on GitHub.