Documentation
Ask on ChatGPT

Flat-File Access with AWS CLI

The fastest way to validate your flat-file access is to export the temporary credentials from the dashboard and run standard `aws s3` commands against the R2 endpoint.

1. Export The Credentials

export-env.sh
export AWS_ACCESS_KEY_ID="<TEMP_ACCESS_KEY_ID>"
export AWS_SECRET_ACCESS_KEY="<TEMP_SECRET_ACCESS_KEY>"
export AWS_SESSION_TOKEN="<TEMP_SESSION_TOKEN>"
export CHD_BUCKET="cryptohftdata-processed"
export CHD_ENDPOINT="https://e5de051a8af1332b58a11bd5b2e40258.r2.cloudflarestorage.com"

2. List The Bucket

This confirms that the temporary credentials, endpoint, and session token are all accepted by the R2 S3-compatible API.

aws-s3-ls
aws s3 ls "s3://$CHD_BUCKET/binance_spot/" \
  --endpoint-url "$CHD_ENDPOINT" \
  --region auto

3. Download A Known Object

aws-s3-cp
aws s3 cp "s3://$CHD_BUCKET/binance_spot/2025-08-01/20/BTCUSDT_trades.parquet.zst" ./BTCUSDT_trades.parquet.zst \
  --endpoint-url "$CHD_ENDPOINT" \
  --region auto

4. Download All Data For One Date

Object keys follow the pattern {exchange}/{YYYY-MM-DD}/{HH}/{symbol}_{data_type}.parquet.zst. To pull every hour for one exchange on one date, copy that date prefix recursively.

aws-s3-cp-date-recursive
aws s3 cp "s3://$CHD_BUCKET/binance_spot/2025-08-01/" ./binance_spot_2025-08-01/ \
  --recursive \
  --endpoint-url "$CHD_ENDPOINT" \
  --region auto

Required Parameters

Keep `--endpoint-url` pointed at your account-specific R2 endpoint and keep `--region auto`. Both are required for standard AWS tooling to work correctly against R2.

Have questions?

Our support team is available to help you with integration.

Contact Support