You need to upload a file to S3 and cannot install new packages in the server, nor the s3 client tools. You only have bash, openssl and sed. Go.
I found and adapted a script by Viktor Szakats, that creates all the proper headers expected by the latest AWS API. I had lots of trouble with whitespaces and empty lines. Be mindful of that when modifying these scripts:
run them like:
. s3-upload-aws4.sh "myfile.ext" "my_bucket_name" "folder_name_in_bucket" "region" "REDUCED_REDUNDANCY" "MY_AWS_ACCESS_KEY" "MY_AWS_SECRET_KEY"