Skip to content

Instantly share code, notes, and snippets.

@phildier
Created December 31, 2015 21:25
Show Gist options
  • Select an option

  • Save phildier/f8e2ab3d1427a9c6a4cd to your computer and use it in GitHub Desktop.

Select an option

Save phildier/f8e2ab3d1427a9c6a4cd to your computer and use it in GitHub Desktop.
pipe tar output to an s3 file
#!/bin/bash
# tar up a file or directory and copy it to an s3 object without any temporary files
# usage:
# $ tar-to-s3.sh <source file or dir> <destination s3 path>
# example:
# $ tar-to-s3.sh . s3://mybucket/archive.tar
src=$1
dst=$2
tar -c "$src" | aws s3 cp - "$dst"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment