Last active
September 19, 2025 00:01
-
-
Save rubyman/cef14548ac4fb71762ff7ba8ab8f15d8 to your computer and use it in GitHub Desktop.
A shell script to upload a file to minio buckets - Original script: https://github.com/kneufeld/minio-put/
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 characters
| #!/bin/bash | |
| # usage: ./minio-upload my-bucket my-file.zip minio-host.com access_key secret | |
| bucket=$1 | |
| file=$2 | |
| minio_host=$3 | |
| access_key=$4 | |
| secret=$5 | |
| host=${S3_HOST:-$minio_host} | |
| s3_key=${S3_KEY:-$access_key} | |
| s3_secret=${S3_SECRET:-$secret} | |
| base_file=`basename ${file}` | |
| resource="/${bucket}/${base_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` | |
| # change to https | |
| curl -v -X PUT -T "${file}" \ | |
| -H "Host: $host" \ | |
| -H "Date: ${date}" \ | |
| -H "Content-Type: ${content_type}" \ | |
| -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
@konstantingoretzki Got it, thanks. Perhaps the author preferred env param rather than command line one😂