Created
October 11, 2021 16:16
-
-
Save xolian/6afbd5f79b5249ce77a24196e075baf3 to your computer and use it in GitHub Desktop.
Revisions
-
xolian renamed this gist
Oct 11, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
xolian created this gist
Oct 11, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ [Uploading to S3 in sh](https://tmont.com/blargh/2014/1/uploading-to-s3-in-bash) ``` file=/path/to/file/to/upload.tar.gz bucket=your-bucket resource="/${bucket}/${file}" contentType="application/x-compressed-tar" dateValue=`date -R` stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}" s3Key=xxxxxxxxxxxxxxxxxxxx s3Secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 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.amazonaws.com/${file} ```