Skip to content

How to use curl with minio

Cesar Celis Hernandez edited this page Mar 22, 2023 · 1 revision

Objective:

How to use curl with MinIO

Links from where we got it:

PUT:

cd /Users/cniackz/Desktop
bucket=testing
file=arbol.jpg
host=play.min.io
s3_key='Q3AM3UQ867SPQQA43P2F'
s3_secret='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
resource="/testing/arbol.jpg"
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 "Host: $host" \
          -H "Date: ${date}" \
          -H "Content-Type: ${content_type}" \
          -H "Authorization: AWS ${s3_key}:${signature}" \
          https://$host${resource}
image

GET:

cd /Users/cniackz/Desktop/temporalnewdiretory
bucket=testing
file=arbol.jpg
host=play.min.io
s3_key='Q3AM3UQ867SPQQA43P2F'
s3_secret='zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG'
resource="/testing/arbol.jpg"
content_type="application/octet-stream"
date=`date -R`
_signature="GET\n\n${content_type}\n${date}\n${resource}"
signature=`echo -en ${_signature} | openssl sha1 -hmac ${s3_secret} -binary | base64`
curl -o ./arbol-2.jpg -v \
          -H "Host: $host" \
          -H "Date: ${date}" \
          -H "Content-Type: ${content_type}" \
          -H "Authorization: AWS ${s3_key}:${signature}" \
          https://$host${resource}

Cesars-MacBook-Pro:temporalnewdiretory cniackz$ ls
arbol-2.jpg
Cesars-MacBook-Pro:temporalnewdiretory cniackz$ open .
Screenshot 2023-03-22 at 11 56 57 AM
Clone this wiki locally