Skip to content

Instantly share code, notes, and snippets.

@fazlurr
Created August 25, 2019 04:17
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 fazlurr/92b1111e68051f071a7fcc882d943366 to your computer and use it in GitHub Desktop.
Save fazlurr/92b1111e68051f071a7fcc882d943366 to your computer and use it in GitHub Desktop.
file=
region=ap-southeast-1
bucket=
resource="/${bucket}/${file}"
contentType="application/zip"
dateValue=`date -R`
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}"
s3Key=
s3Secret=
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64`
curl -X PUT -T "${file}" \
-H "Host: ${bucket}.s3.amazonaws.com" \
-H "Date: ${dateValue}" \
-H "Content-Type: ${contentType}" \
-H "Authorization: AWS ${s3Key}:${signature}" \
https://${bucket}.s3-${region}.amazonaws.com/${file}
$SHELL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment