Skip to content

Instantly share code, notes, and snippets.

@ryandotclair
Last active March 30, 2026 13:20
Show Gist options
  • Select an option

  • Save ryandotclair/c0617fa95b3a223ea770b3cc41e35df1 to your computer and use it in GitHub Desktop.

Select an option

Save ryandotclair/c0617fa95b3a223ea770b3cc41e35df1 to your computer and use it in GitHub Desktop.
Object simple test
# 1. Configuration
ACCESS_KEY="your-key"
SECRET_KEY="your-secret"
ENDPOINT="example.com"
BUCKET="test-bucket"
FILE="upload-test.txt" # The name of the file ALREADY in the bucket
LOCAL_TARGET="downloaded_file.txt"
# 2. Signature Setup (Method is now GET)
date_value=$(date -R)
resource="/${BUCKET}/${FILE}"
content_type="application/octet-stream"
sig_string="GET\n\n${content_type}\n${date_value}\n${resource}"
# 3. Generate Signature
signature=$(echo -en "${sig_string}" | openssl sha1 -hmac "${SECRET_KEY}" -binary | base64)
# 4. Execute GET with -k
# -o saves the output to a file instead of printing to terminal
curl -k -v -X GET \
"https://${ENDPOINT}${resource}" \
-o "$LOCAL_TARGET" \
-H "Date: ${date_value}" \
-H "Content-Type: ${content_type}" \
-H "Authorization: AWS ${ACCESS_KEY}:${signature}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment