Obtaining client to Ozone through session
You must obtain a client to Ozone through a session.
For more information, see Amazon Boto3 documentation.
Create a session
session = boto3.session.Session()
Obtain s3 client to Ozone via session:
s3_client = session.client(
service_name='s3',
aws_access_key_id='testuser/scm@EXAMPLE.COM',
aws_secret_access_key='c261b6ecabf7d37d5f9ded654b1c724adac9bd9f13e247a235e567e8296d2999',
endpoint_url='http://localhost:9878',
)
'endpoint_url' is pointing to Ozone s3 endpoint.
In our code sample below, we're demonstrating the usage of both s3 and s3_client.
There are multiple ways to configure Boto3 client credentials if you’re connecting to a secured cluster. In these cases, the above lines of passing ‘aws_access_key_id’ and ‘aws_secret_access_key’ when creating Ozone s3 client shall be skipped.
For more information, see Boto3 documentation.