Your First AIStore Object with Python
AIStore’s Python SDK lets you create a bucket, upload bytes, list objects, and verify a download. For deployment choices, refer to Getting Started.
Prerequisites
- Python 3.10 or later, as required by the SDK’s
python/pyproject.toml. - A running AIStore cluster where you can create buckets. For a maintained local source deployment, use the local playground. Alternatively, the Minimal Compose deployment is a limited, one-proxy, one-target container smoke test, not a production deployment; it does not configure TLS or AuthN.
- The HTTP endpoint of a reachable AIS proxy. The default local playground endpoint is
http://localhost:8080; the default Minimal Compose host endpoint ishttp://localhost:51080. For a remote or differently configured cluster, obtain its actual endpoint from the cluster administrator and use that instead. - Client access to the target URLs returned by that proxy for object PUT and GET, with trusted TLS certificates at both proxy and target URLs when using HTTPS. The default host-local Playground and Compose paths provide local proxy and target access. For a remote cluster, check the advertised target addresses with the administrator: a proxy-only SSH or Kubernetes port-forward can allow bucket creation but fail object I/O after redirection. Refer to read and write traffic patterns for the proxy-to-target path.
Install and Connect
Ensure python3 resolves to Python 3.10 or later, then create a virtual environment and install the SDK:
Select the endpoint for the deployment you started. For the default local playground:
For the default Minimal Compose smoke test, use this instead:
Use your cluster’s actual proxy URL if it differs from these defaults.
If your cluster requires an authentication token, supply one through AIS_AUTHN_TOKEN or the Client(token=...) argument; refer to authentication validation and the SDK authentication settings. For HTTPS with a private trusted certificate authority (CA), set AIS_CLIENT_CA to its certificate file or pass Client(ca_cert=...); refer to the SDK HTTPS guidance. Use certificate verification, not skip_verify, and confirm that skip-verification environment variables are not enabled.
Create, List, and Read an Object
Run this from the shell where you installed the SDK and set AIS_ENDPOINT:
Expected output:
The script prints its unique AIS bucket name before creation, checks that the uploaded object appears in the listing, compares downloaded bytes, and deletes the bucket it created. If creation fails, it does not delete an existing bucket. A failed request, verification, or cleanup raises an exception instead of printing final success; confirm the endpoint and permissions before retrying. If interrupted before cleanup, use the printed bucket name to inspect the tutorial bucket before removing it; leave other buckets untouched.
For more SDK operations, refer to the Python SDK reference and SDK README.