github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/python/aistore/botocore_patch/README.md (about)

     1  ## AIS Botocore Patch
     2  
     3  As an alternative to the [AIStore Python SDK](https://aiatscale.org/docs/python_sdk.md), you may prefer to use Amazon's popular [Boto3](https://github.com/boto/boto3) library, or possibly [botocore](https://github.com/boto/botocore), which *boto3* uses under the hood.
     4  
     5  By default, botocore doesn't handle [HTTP redirects](https://www.rfc-editor.org/rfc/rfc7231#page-54), which prevents you from using it with AIStore.
     6  
     7  To resolve this, install `aistore` with the `botocore` extra,  and then import `aistore.botocore_patch.botocore` in your code. This will dynamically patch HTTP redirect support into botocore, via [monkey patch](https://www.tutorialspoint.com/explain-monkey-patching-in-python).
     8  
     9  ```shell
    10  $ pip install aistore[botocore]
    11  ```
    12  
    13  ```python
    14  import boto3
    15  from aistore.botocore_patch import botocore
    16  ```
    17  
    18  ## Cluster Configuration
    19  
    20  To use AIS as an S3 client, you must first configure the cluster. 
    21  
    22  Set the cluster to run as an S3 client:
    23  
    24  ```shell
    25  ais config cluster features S3-API-via-Root
    26  ```
    27  
    28  S3 uses MD5 hashes, so set the cluster to use it:
    29  
    30  ```shell
    31  ais config cluster checksum.type=md5
    32  ```
    33  
    34  Now AIS will accept S3 commands and behave as an S3 client. 
    35  
    36  ## References
    37  
    38  * [AIStore GitHub](https://github.com/NVIDIA/aistore)
    39  * [Documentation](https://aiatscale.org/docs)
    40  * [AIStore pip package](https://pypi.org/project/aistore/)
    41  * [Videos and demos](https://github.com/NVIDIA/aistore/blob/main/docs/videos.md)