When executing the script using this method, the following encoding error occurred:
Error: invalid byte sequence in UTF-8
I generated a key using the following method and used it to create a signature, then utilized the signature as the token to connect to ElastiCache, but encountered persistent errors.
signing_key=$(printf "AWS4$aws_access_key_id")
signing_key=$(echo -n "$datestamp" | openssl dgst -sha256 -mac HMAC -macopt key:"$signing_key" | cut -d' ' -f2)
signing_key=$(echo -n "$aws_region" | openssl dgst -sha256 -mac HMAC -macopt key:"$signing_key" | cut -d' ' -f2)
signing_key=$(echo -n "$service" | openssl dgst -sha256 -mac HMAC -macopt key:"$signing_key" | cut -d' ' -f2)
signing_key=$(echo -n "aws4_request" | openssl dgst -sha256 -mac HMAC -macopt key:"$signing_key" | cut -d' ' -f2)
signature=$(echo -en "$string_to_sign" | openssl dgst -sha256 -sign "$signing_key"| cut -d' ' -f2)
Could you help me analyze the specific cause of the error? thanks so much.