Created
June 23, 2015 00:38
-
-
Save hiroshi/d20e7a6b0314f9ef1263 to your computer and use it in GitHub Desktop.
This file contains 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
# http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
# file=xxxx | |
# bucket=xxxx | |
# s3Key=xxxx | |
# s3Secret=xxxx | |
resource=/${bucket}/${file} | |
contentType=binary/octet-stream | |
dateValue := $(shell date "+%a, %d %b %Y %H:%M:%S %z") | |
SHELL=bash # Enable echo -ne option | |
signature:=$(shell echo -ne "PUT\n\n${contentType}\n${dateValue}\n${resource}" | openssl sha1 -hmac ${s3Secret} -binary | base64) | |
upload-update: | |
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