Skip to content

dnl555/go-snap-to-s3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-snap-to-s3

A Go implementation of snap-to-s3 - Upload EBS snapshots to Amazon S3.

Overview

This is a complete rewrite of the original Node.js snap-to-s3 tool in Go, providing:

  • EBS Snapshot Migration: Create temporary volumes from snapshots, compress them, and upload to S3
  • Validation: Verify uploaded snapshots against original EBS snapshots
  • Compression: Support for LZ4 and ZSTD compression
  • Encryption: Optional GPG encryption and AWS SSE support
  • Flexible Volume Types: Auto-select volume types (gp3 for ≤126GB, st1 for larger)

Features

  • ✅ Migrate EBS snapshots to S3
  • ✅ Validate uploaded snapshots
  • ✅ LZ4 and ZSTD compression
  • ✅ Server-side encryption (AES256, aws:kms)
  • ✅ GPG encryption support
  • ✅ Automatic volume type selection
  • ✅ Tag-based snapshot management
  • ✅ Concurrent upload streams

Installation

go build -o go-snap-to-s3

Usage

Migrate Snapshots

Migrate all snapshots tagged for migration:

./go-snap-to-s3 migrate --bucket my-bucket --all

Migrate one snapshot:

./go-snap-to-s3 migrate --bucket my-bucket --one

Migrate specific snapshots:

./go-snap-to-s3 migrate --bucket my-bucket --snapshots snap-12345,snap-67890

Validate Snapshots

Validate all migrated snapshots:

./go-snap-to-s3 validate --bucket my-bucket --all

Options

  • --tag: Tag name for marking snapshots (default: "snap-to-s3")
  • --bucket: S3 bucket to upload to (required)
  • --mount-point: Temporary mount point (default: "/mnt")
  • --volume-type: Volume type (auto, gp3, gp2, st1, standard)
  • --compression: Compression type (lz4 or zstd)
  • --compression-level: Compression level (1-9 for lz4, 1-19 for zstd)
  • --upload-streams: Number of concurrent upload streams
  • --dd: Use dd for raw disk image instead of tar
  • --sse: Server-side encryption (AES256 or aws:kms)
  • --gpg-recipient: GPG recipient for encryption
  • --keep-temp-volumes: Don't delete temporary volumes

Requirements

  • Go 1.21 or later
  • AWS credentials configured
  • Running on an EC2 instance
  • Required system utilities: lsblk, tar, mount, umount, lz4/zstd

Differences from Node.js Version

This Go implementation provides:

  • Better performance and lower memory usage
  • Native concurrency support
  • Simpler deployment (single binary)
  • Type safety and better error handling

License

0BSD - Same as the original snap-to-s3 project

About

go-snap-to-s3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors