Skip to content

Instantly share code, notes, and snippets.

@fervic
Created September 9, 2017 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fervic/cebc8ecbd2c36077b470cea810a253b6 to your computer and use it in GitHub Desktop.
Save fervic/cebc8ecbd2c36077b470cea810a253b6 to your computer and use it in GitHub Desktop.
Stream S3 file contents to a UNIX pipe
#!/usr/bin/env sh
BUCKET=<bucket name>
PATH=<path to file(s)>
for key in `/usr/bin/aws s3api list-objects --bucket $BUCKET --prefix $PATH | /usr/bin/jq -r '.Contents[].Key'`
do
echo $key
/usr/bin/aws s3 cp s3://$BUCKET/$key - | /usr/bin/wc -l
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment