Sign inSign up

jkaninda/s3safe

By jkaninda

Updated over 1 year ago

A simple lightweight CLI tool for backing up and restoring data from S3 & S3-compatible storage

Image
0

2.9K

jkaninda/s3safe repository overview

S3Safe - S3 Backup & Restore Tool

GitHub Release Go Report Card Go Reference Docker Image Size

S3Safe is simple a lightweight CLI tool for backing up and restoring data from Amazon S3 and S3-compatible storage.

Installation

# Using Go
go install github.com/jkaninda/s3safe@latest

# Using Docker
docker pull jkaninda/s3safe:latest

Configuration

Copy .env.example to .env and configure your S3 credentials:

AWS_REGION=us-east-1
AWS_ENDPOINT=https://s3.wasabisys.com
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_KEY=your_secret_key
AWS_BUCKET=your_bucket_name
AWS_FORCE_PATH="true"  # For path-style URLs
AWS_DISABLE_SSL="false"  # Set "true" for non-HTTPS endpoints

Command Reference

Global Options
OptionShortDescription
--exclude-eExclude files/directories (comma-separated patterns)
--recursive-rProcess directories recursively
--path-pSource directory path
--dest-dDestination path (in S3 or local filesystem)
--file-fProcess single file instead of directory
--ignore-errors-iContinue on errors during restore
--env-fileCustom environment file (default: .env)
--help-hShow help message
--version-vShow version information
Backup Options
OptionShortDescription
--compress-cCompress before upload (creates .tar.gz)
--timestamp-tAdd timestamp to compressed filename
Restore Options
OptionShortDescription
--decompress-DDecompress after download
--forceForce restore to destination path, overwrite existing files

Usage Examples

Backup Operations

Backup directory (compressed):

s3safe backup -p ./backups -d /s3path --compress --timestamp

Backup single file:

s3safe backup --file data.db --dest /s3path/db-backups --compress

Non-compressed directory backup:

s3safe backup -p ./backups -d /s3path/backups -r
Restore Operations

Restore compressed backup:

s3safe restore -p /s3path/backup.tar.gz -d ./backups --decompress

Restore directory (recursive):

s3safe restore --path /s3path --dest ./backups --recursive
Docker Usage

Backup with Docker:

docker run --rm --env-file .env \
  -v "./backups:/backups" \
  jkaninda/s3safe:latest \
  backup --path /backups -d s3path --compress

Restore with Docker:

docker run --rm --env-file .env \
  -v "./restored:/restored" \
  jkaninda/s3safe:latest \
  restore --path s3path/backup.tar.gz -d /restored --decompress

License

MIT License - See LICENSE for details.

Tag summary

Content type

Image

Digest

sha256:a9743518a

Size

11.2 MB

Last updated

over 1 year ago

docker pull jkaninda/s3safe