Created
May 26, 2016 15:00
-
-
Save pandeybk/077ade4844c8fb114ec8f073a9a5e3e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file=id_rsa.pub | |
bucket=com.dgmates.public.bucket | |
resource="/${bucket}/${file}" | |
contentType="text/plain" | |
dateValue="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")" | |
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}" | |
s3Key=<AWS_ACCESS_KEY_ID> | |
s3Secret=<AWS_ACCESS_KEY_SECRET> | |
signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64` | |
curl -k -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.amazonaws.com/${file} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment