Skip to content

Instantly share code, notes, and snippets.

@webnitros
Forked from PhilipSchmid/minio-upload.sh
Created August 3, 2023 04:33
Show Gist options
  • Save webnitros/7645f936a8bed82603d79776385c8683 to your computer and use it in GitHub Desktop.
Save webnitros/7645f936a8bed82603d79776385c8683 to your computer and use it in GitHub Desktop.
Upload data to Minio using CURL
#!/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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment