up load binaries images to bucket (s3) using cURL and put

0

HI everyone, I want to up load binaries images to bucket (s3) using cURL and put from another server using python. I tried to many ways to do (Shell script, python) but I can't do it.

Could you guide me How to do or how to start?

1 Answer
3
Accepted Answer

try this https://gist.github.com/tuxfight3r/7ccbd5abc4ded37ecdbc8fa46966b7e8

  file_path=$1
  aws_path=$2
  bucket="${S3BUCKET}"
  date=$(date -R)
  acl="x-amz-acl:private"
  content_type="application/x-compressed-tar"
  storage_type="x-amz-storage-class:${S3STORAGETYPE}"
  string="PUT\n\n$content_type\n$date\n$acl\n$storage_type\n/$bucket$aws_path${file_path##/*/}"
  signature=$(echo -en "${string}" | openssl sha1 -hmac "${S3SECRET}" -binary | base64)
  curl -s --retry 3 --retry-delay 10 -X PUT -T "$file_path" \
       -H "Host: $bucket.${AWSREGION}.amazonaws.com" \
       -H "Date: $date" \
       -H "Content-Type: $content_type" \
       -H "$storage_type" \
       -H "$acl" \
       -H "Authorization: AWS ${S3KEY}:$signature" \
       "https://$bucket.${AWSREGION}.amazonaws.com$aws_path${file_path##/*/}"

Similar question for pre-signed URL https://repost.aws/questions/QU2Yq1fA_mRB-yAqC2_XpkVw/s3-signed-urls-via-the-cli-for-put-using-curl

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
Artem
reviewed 5 days ago
profile pictureAWS
EXPERT
reviewed 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions