This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify these vars first | |
export CLOUDFLARE_ACCOUNT_ID=24bac... | |
export CLOUDFLARE_API_TOKEN=eGCxnU... | |
# then derive the AWS S3 credentials | |
export AWS_ACCESS_KEY_ID=$(curl -s https://api.cloudflare.com/client/v4/user/tokens/verify -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" | jq -r '.result.id') | |
export AWS_SECRET_ACCESS_KEY=$(echo -n $CLOUDFLARE_API_TOKEN | shasum -a 256 | awk '{print $1}') | |
export AWS_ENDPOINT_URL=https://$CLOUDFLARE_ACCOUNT_ID.r2.cloudflarestorage.com | |
# output the credentials |