Boto3 Python SDK
Boto3 is the official AWS SDK for Python. It allows you to create, update, and configure IONOS S3 Object Storage objects from within your Python scripts.
Configuration
Install the latest Boto3 release via pip: pip install boto3
There are several ways to provide credentials, e.g. passing credentials as parameters to the boto.client() method, via environment variables, or with a generic credential file (~/.aws/credentials).
An example of passing credentials as parameters when creating a Session object:
To get the Access Key and Secret Key, log in to the DCD, and go to Menu > Storage > IONOS S3 Object Storage > Key management.
NOTE: Your credentials are not tied to a specific region or bucket.
For information on the supported IONOS S3 Object Storage Service endpoints, see S3 Endpoints.
Sample usage
List buckets:
Create bucket
my-bucket
at the regioneu-central-1
:Upload filename.txt to the bucket
my-bucket
:For more information, see AWS SDK documentation on Uploading files.
Download the file
filename.txt
from themy-bucket
:List objects of the bucket
my-bucket
Copy the filename.txt from the bucket
my-source-bucket
to the bucketmy-dest-bucket
and add the prefixuploaded/
. Instead of theclient()
method, we use theresource()
method here. It provides a higher level of abstraction than the low-level calls made by service clients.
For more examples, see Boto3 documentation, such as:
For more information on Boto3 and Python, see Realpython.com – Python, Boto3, and AWS S3: Demystified.
Last updated