Skip to content

Instantly share code, notes, and snippets.

@jazinheira
Created March 14, 2017 19:48
Show Gist options
  • Save jazinheira/96705fdcfdb56bf6c7df2a85f72c2761 to your computer and use it in GitHub Desktop.
Save jazinheira/96705fdcfdb56bf6c7df2a85f72c2761 to your computer and use it in GitHub Desktop.
bucket=your-bucket-name
contentType="text/plain"
dateValue="`date +'%a, %d %b %Y %H:%M:%S %z'`"
stringToSign="GET\n\n${contentType}\n${dateValue}\n${resource}"
s3Key=xxxxxx
s3Secret=xxxxx
signature=`/bin/echo -en "$stringToSign" | openssl sha1 -hmac ${s3Secret} -binary | base64`
file1=file-name
resource1="/${bucket}/${file1}"
curl -H "Date: ${dateValue}" -H "Content-Type: ${contentType}" -H "Authorization: AWS ${s3Key}:${signature}" "https://s3-us-west-2.amazonaws.com/${resource1}" -o "file-name-to-save-the-output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment