Skip to content

Instantly share code, notes, and snippets.

@Lajule
Last active April 3, 2023 15:26
Show Gist options
  • Save Lajule/4b5610dc2055368af0ba2ff13e0b50bc to your computer and use it in GitHub Desktop.
Save Lajule/4b5610dc2055368af0ba2ff13e0b50bc to your computer and use it in GitHub Desktop.
Download file from S3
#!/bin/bash
if (( $# < 4 )); then
echo 'Missing arguments' >&2
exit 1
fi
UTC="$(date -R --utc)"
http -d "$1/$2" \
"Host:$1" \
"Date:${UTC}" \
"Authorization:AWS $3:$(printf "GET\n\n\n%s\n/%s" "${UTC}" "$2" | openssl sha1 -hmac "$4" -binary | base64)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment