Using Scaleway's Object Storage S3 API with boto3 in Python 3

Revision history
Tags: s3 scaleway


I needed to find a library for Python 3 to browse the S3 API of Scaleway’s Object Storage. boto3 is Amazon’s own project, bringing full support for the S3 protocol.

In turn, I’m going to use this to periodically purge old backup files from a backup bucket.

How to

Install boto3 using pip

# pip install boto3

The below Python 3 program will list the name of all the current buckets you have.

import os
import boto3

session  = boto3.Session(region_name="nl-ams")
resource = session.resource('s3',

for bucket in resource.buckets.all():

It appears to be very important to specify the region_name when initialising the session object. When not specified, the endpoint_url is rewritten into, and the request will fail.


If you have any comments or feedback, please send me an e-mail. (stig at stigok dotcom).

Did you find any typos, incorrect information, or have something to add? Then please propose a change to this post.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.