Skip to main content

A tool to copy files between S3 buckets across AWS accounts

Project description

s3hop - Cross-account S3 bucket streaming copy

PyPI version Python Versions License: MIT Downloads

A command-line tool to efficiently copy files between S3 buckets across different AWS accounts.

Features

  • Copy files between S3 buckets across different AWS accounts
  • Smart file comparison to only copy new or updated files
  • Progress tracking with ETA and transfer speed
  • Detailed transfer summary with file type statistics
  • Handles large files and directories efficiently using streaming
  • Preserves file structure between source and destination

Quick Start

# Install
pip install s3hop

# Use
s3hop source-profile s3://source-bucket/prefix/ dest-profile s3://dest-bucket/prefix/

Installation

You can install this package directly from PyPI:

pip install s3hop

Or install from source:

git clone https://github.com/thehamsti/s3hop.git
cd s3hop
pip install .

Prerequisites

  1. Python 3.6 or later
  2. AWS credentials configured for both source and destination accounts
  3. Appropriate S3 permissions in both accounts

AWS Credentials Setup

  1. Configure your AWS credentials for both accounts in ~/.aws/credentials:
[source-profile]
aws_access_key_id = YOUR_SOURCE_ACCESS_KEY
aws_secret_access_key = YOUR_SOURCE_SECRET_KEY

[dest-profile]
aws_access_key_id = YOUR_DEST_ACCESS_KEY
aws_secret_access_key = YOUR_DEST_SECRET_KEY
  1. Ensure you have the necessary S3 permissions:
    • Source bucket: s3:ListBucket, s3:GetObject
    • Destination bucket: s3:ListBucket, s3:PutObject

Usage

Basic usage:

s3hop source-profile s3://source-bucket/prefix/ dest-profile s3://dest-bucket/prefix/

Example with specific profiles and paths:

s3hop prod s3://prod-bucket/data/ staging s3://staging-bucket/backup/

Arguments

  • source-profile: AWS profile for the source account
  • source_url: Source S3 URL (s3://bucket-name/prefix/)
  • dest-profile: AWS profile for the destination account
  • dest_url: Destination S3 URL (s3://bucket-name/prefix/)

Features in Detail

  1. Smart File Comparison

    • Compares files using ETags and last modified timestamps
    • Only copies new or updated files
    • Preserves existing files that haven't changed
  2. Progress Tracking

    • Real-time transfer speed
    • Estimated time remaining
    • Progress bar with file counts
    • Total data transferred/remaining
  3. Transfer Summary

    • Start and end times
    • Duration
    • Number of files transferred/skipped
    • File type statistics
    • Failed transfers (if any)

Development

For development setup and contributing guidelines, see CONTRIBUTING.md.

Changelog

See CHANGELOG.md for a list of changes and version history.

Security

For security issues, please email security@hamsti.co instead of using the issue tracker.

Support

License

MIT License - see LICENSE for details.

Acknowledgments

  • Built with boto3
  • Progress bars powered by tqdm

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s3hop-0.1.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3hop-0.1.5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file s3hop-0.1.5.tar.gz.

File metadata

  • Download URL: s3hop-0.1.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for s3hop-0.1.5.tar.gz
Algorithm Hash digest
SHA256 458ab37095f78e180c32e5d5afec2d034286328fef54780cc24b709c98c85cb7
MD5 33221254463ffe74deb6c39fe1286b6e
BLAKE2b-256 277a38e16ec242d9576def0f856a6734f31dfbe389d390c4b653aaa5ed96de81

See more details on using hashes here.

Provenance

The following attestation bundles were made for s3hop-0.1.5.tar.gz:

Publisher: publish.yml on thehamsti/s3hop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file s3hop-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: s3hop-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for s3hop-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7a42b7e51f2836c12c614561b747a32bfa677d4c6ac32d69e2ac4b4bb6ba7299
MD5 149122bfb4e2ac31969c6bc34d67b361
BLAKE2b-256 e8f7cd4d57ad4ba4608cbde069e1ab7a61031be0241603c9d1548aa249dbc19f

See more details on using hashes here.

Provenance

The following attestation bundles were made for s3hop-0.1.5-py3-none-any.whl:

Publisher: publish.yml on thehamsti/s3hop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page