Connect AWS SDKs and mc-compatible clients to the gateway.
This tutorial connects the AWS CLI and the Python SDK (boto3) to a Silo PostgreSQL gateway, generates a presigned download URL, and configures bucket CORS for browser requests. Complete the Quick start first so the attachments bucket, app-s3 user and local hello.txt file exist.
Set the endpoint and working directory in your terminal:
Save the following script as ~/.local/share/silo-tutorial/sdk.py:
importosimportboto3frombotocore.configimportConfigsession=boto3.Session(profile_name="silo-app",region_name="us-east-1")s3=session.client("s3",endpoint_url=os.environ["SILO_ENDPOINT"],verify=os.environ["AWS_CA_BUNDLE"],config=Config(signature_version="s3v4",s3={"addressing_style":"path"}),)s3.put_object(Bucket="attachments",Key="sdk.txt",Body=b"hello from Python\n")response=s3.get_object(Bucket="attachments",Key="sdk.txt")try:print(response["Body"].read().decode("utf-8"))finally:response["Body"].close()
Run "$HOME/.local/share/silo-tutorial/venv/bin/python" "$HOME/.local/share/silo-tutorial/sdk.py". It prints hello from Python.
Keep default SDK checksums and TLS verification enabled. When uploading larger files with SDK multipart helpers, the completed object must fit within the store’s maximum object size (256 MiB by default, up to 1 GiB if configured at initialization).
Presigned URLs and bucket CORS
Generate a presigned GET URL valid for 15 minutes (900 seconds) using the s3 client from above:
A presigned URL carries the signing principal’s permissions and cannot grant access that the signer lacks. If signed by temporary STS credentials, the URL stops working when the session expires even if ExpiresIn is longer.
To allow browser uploads or downloads from another origin, configure a bucket CORS rule with an administrative profile (silo-admin):
A matching preflight request returns the allowed origin and methods in the response headers; a rejected preflight returns HTTP 403 (AccessForbidden). CORS headers do not bypass SigV4 signing or IAM authorization.