1 Answer
- Newest
- Most votes
- Most comments
3
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
Relevant content
- asked a year ago
- asked 2 years ago
- asked 5 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Thank you so much. I modified the shell Script then run it. Works perfectly. This is the file: https://github.com/KokiHasegawaEspinal/s3_send_images/blob/main/s3_send_images_template.sh