Created
November 26, 2019 18:14
-
-
Save CAJan93/b5f484af15f8f161431fbf3c154bc0e5 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
#!/bin/bash | |
# usage: ./minio-upload my-bucket my-file.zip | |
bucket=$1 | |
file=$2 | |
host=172.17.0.2:9000 | |
s3_key='minio' | |
s3_secret='miniostorage' | |
resource="/${bucket}/${file}" | |
content_type="application/octet-stream" | |
date=`date -R` | |
_signature="PUT\n\n${content_type}\n${date}\n${resource}" | |
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64` | |
curl -v -X PUT -T "${file}" \ | |
-H "Date: ${date}" \ | |
-H "Content-Type: ${content_type}" \ | |
-H "Host: $host" \ | |
-H "Authorization: AWS ${s3_key}:${signature}" \ | |
http://$host${resource} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment