Skip to content

Instantly share code, notes, and snippets.

@CAJan93
Created November 26, 2019 18:14
Show Gist options
  • Save CAJan93/b5f484af15f8f161431fbf3c154bc0e5 to your computer and use it in GitHub Desktop.
Save CAJan93/b5f484af15f8f161431fbf3c154bc0e5 to your computer and use it in GitHub Desktop.
#!/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