Created
November 19, 2020 13:38
-
-
Save PhilipSchmid/1fd2688ace9f51ecaca2788a91fec133 to your computer and use it in GitHub Desktop.
Upload data to Minio using CURL
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=minio.example.com | |
s3_key=svc_example_user | |
s3_secret=svc_example_user_password | |
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 -X PUT -T "${file}" \ | |
-H "Host: ${host}" \ | |
-H "Date: ${date}" \ | |
-H "Content-Type: ${content_type}" \ | |
-H "Authorization: AWS ${s3_key}:${signature}" \ | |
https://${host}${resource} |
I am getting the above response from the Curl command. Am I missing something?
I was getting the same error.
Only change I made is, changed the port in Host entry from 9001 to 9000. And it worked fine for me.
If the filename can contain whitespace you have to urlEncode it:
resource=/${bucket}/$(echo "${filename}" | jq -sRr @uri)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
<!doctype html><title>MinIO Console</title><script defer="defer" src="./static/js/main.4a881f62.js"></script>You need to enable JavaScript to run this app.