File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,11 @@ def s3_client(self) -> Optional[boto3.client]:
7474 region_name = self .aws_region ,
7575 )
7676 else :
77- logger . error ( "AWS credentials not found" )
78- logger .warning (
79- "Set AWS_PROFILE or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY environment variables "
77+ # Fall back to default credential chain (includes EC2 instance profile, ECS task role, etc. )
78+ logger .info (
79+ "Using AWS default credential chain (EC2 instance profile, ECS task role, etc.) "
8080 )
81- raise NoCredentialsError ( )
81+ self . _s3_client = boto3 . client ( "s3" , region_name = self . aws_region )
8282
8383 # Test connection
8484 self ._s3_client .head_bucket (Bucket = self .bucket_name )
@@ -92,6 +92,11 @@ def s3_client(self) -> Optional[boto3.client]:
9292 logger .error (f"S3 error: { e } " )
9393 raise
9494 except NoCredentialsError :
95+ logger .error ("AWS credentials not found" )
96+ logger .warning (
97+ "Set AWS_PROFILE or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY environment variables, "
98+ "or run on EC2 instance with IAM role"
99+ )
95100 raise
96101 except Exception as e :
97102 logger .error (f"AWS authentication error: { e } " )
You can’t perform that action at this time.
0 commit comments