Prerequisites
Backblaze B2 uses Mage’s S3-compatible client, which depends onboto3. Docker
and full dev installs already include it. If you installed Mage with a plain
pip install mage-ai, install the s3 extra so the dependency is present:
Add credentials
- Create a new pipeline or open an existing pipeline.
- Expand the left side of your screen to view the file browser.
-
Scroll down and click on a file named
io_config.yaml. -
Enter the following keys and values under the key named
default(you can have multiple profiles, add it under whichever is relevant to you)For backwards compatibility, the loader also falls back toAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_ENDPOINT(for the endpoint URL) when the correspondingB2_*keys are not set.
Using Python block
- Create a new pipeline or open an existing pipeline.
- Add a data loader or transformer block (the code snippet below is for a data loader).
-
Select
Generic (no template). -
Enter this code snippet (note: change the
config_profilefromdefaultif you have a different profile): - Run the block.
Endpoint override
The default endpoint ishttps://s3.us-west-004.backblazeb2.com. If your
bucket lives in another B2 region, add:
io_config.yaml file. AWS_ENDPOINT is honored as a fallback.
Errors
B2 connection endpoint URL error Open theio_config.yaml file at the root of your project (e.g.
default_repo/io_config.yaml) and confirm that B2_ENDPOINT_URL (if set)
matches the region of your B2 bucket.
Permissions
Ensure the application key you create in the Backblaze B2 console grants the following capabilities on your bucket:readFileswriteFileslistFiles
- Read data from B2 (e.g.
.csv,.parquet,.json) - Write query results or transformed data to B2
- List contents of a bucket when needed
Two common Backblaze B2 gotchas:
- The master application key is not S3-compatible. Create a standard (non-master) application key for use with Mage.
- App keys restricted to a single bucket may also need the
listAllBucketNamescapability for S3 SDK/integration compatibility.