Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Created April 3, 2020 22:48
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 jfeilbach/e829eaed1a6c8d2825f9db74e980b1ea to your computer and use it in GitHub Desktop.
Save jfeilbach/e829eaed1a6c8d2825f9db74e980b1ea to your computer and use it in GitHub Desktop.
authorized_keys.sh
#!/bin/bash
# Version 1.0
# 2019-02-06
set -o errexit
set -o nounset
set -o pipefail
#set -x # remove '#' at start of this line for super-verbose debugging
BUCKET_NAME=""
PREFIX=""
KEYS="$(aws s3api list-objects --bucket ${BUCKET_NAME} --prefix ${PREFIX} --no-paginate | jq -r '.Contents | .[]? | .Key | if (test("[^/]$")) then . else empty end')"
for key in ${KEYS}; do
aws s3 cp "s3://${BUCKET_NAME}/${key}" -
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment