Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Boto 3 is an Amazon Web Services SDK for Python, and provides an easy way to write code to interface with the USS S3 Gateway. The example below shows you can programmatically list all buckets within your USS S3 Gateway instance. While the SDK supports many AWS services, only the S3 calls are relevant to the USS S3 Gateway. More examples and documentation can be found here:


Code Block
#!/usr/bin/env python 

import boto3

session = boto3.session.Session()

s3_client = session.client(
	service_name='s3',
	aws_access_key_id='<username>',
	aws_secret_access_key='<password>',
	endpoint_url='<endpoint-url>'
)

buckets = s3_client.list_buckets()

print('My Buckets:')
for bucket in buckets['Buckets']:
	print(bucket)