Application Programming Interface (API) Support for S3 Access
For advanced tasks or in writing your own software, you may want to interact with Second Tier Storage directly through the S3 programming API. Libraries exist to do this from many programming languages.
- boto is a useful Python library for accessing S3 gateways. We have some simple examples at bottom of the page.
- Amazon::S3 is a Perl library for working with and managing S3 buckets and keys.
- AWS SDK for Java is developed directly by Amazon.
A full list of language libraries supported by Ceph S3 with many examples can be found in the Ceph documentation.
In every case, your program will need to use your s3 credentials to access the S3 service.
Example: Programmatic Access to S3 credentials
To assist with obtaining one's s3 credentials programmatically, MSI has created an "s3info" command that retrieves the S3 credentials associated to the user that runs it. This command is available on login nodes and on Mesabi. A --machine-output option causes it to provide easily parseable output, so you can run it from a bash script or from the language of your choice. The below shell session shows its usage with and without the --machine-output option:
juser@login02 [~]% s3info
Access key: QPBEF6DD3AUY97V89DCH
Secret key: Zcl6xbjQSloQRp2tEdkUdZjPtOdJvN4hWgUH0j6h
Sharing address: email@example.com
juser@login02 [~]% s3info keys --machine-output
Example: Programmatic Access with Python
s3.msi.umn.edu can also be accessed programatically. boto is a useful Python library to interact with an S3 gateway. Below is an example of how to establish a connection and print a list of your buckets.