From c13410789381d3b6c0f2cbcaf899414e7348b5f5 Mon Sep 17 00:00:00 2001 From: Damien Arnodo Date: Sun, 1 Feb 2026 10:39:51 +0000 Subject: [PATCH] fix: configure AwsCredentials with AwsClientParameters for Garage - Use endpoint_url via aws_client_parameters - Set signature_version to s3v4 - Set addressing_style to path - Set region to garage --- setup_blocks.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup_blocks.py b/setup_blocks.py index 5334a15..4c06037 100644 --- a/setup_blocks.py +++ b/setup_blocks.py @@ -4,6 +4,7 @@ Setup Prefect Blocks from environment variables. import os from prefect_aws import AwsCredentials +from prefect_aws.client_parameters import AwsClientParameters from prefect.blocks.system import Secret @@ -16,10 +17,20 @@ def setup_blocks(): aws_endpoint = os.environ.get("AWS_ENDPOINT_URL") if all([aws_access_key, aws_secret_key, aws_endpoint]): + # Configuration client pour Garage (S3-compatible) + client_params = AwsClientParameters( + endpoint_url=aws_endpoint, + config={ + "signature_version": "s3v4", + "s3": {"addressing_style": "path"}, + }, + ) + creds = AwsCredentials( aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_key, - aws_endpoint_url=aws_endpoint, + region_name="garage", + aws_client_parameters=client_params, ) creds.save("garage-credentials", overwrite=True) print("✅ Block 'garage-credentials' created/updated")