VincentChantreau opened a new issue, #37976: URL: https://github.com/apache/airflow/issues/37976
### Apache Airflow Provider(s) amazon ### Versions of Apache Airflow Providers 8.16.0 ### Apache Airflow version 2.8.1 ### Operating System Apache Airflow Official Docker Image ### Deployment Official Apache Airflow Helm Chart ### Deployment details Deployed on AWS EKS ### What happened When using the Glue Operator and enabling the verbose parameter, we get the following error. It's seems that the the GlueHook is not using a LogHook, but rather a newly instancied boto3 client here : https://github.com/apache/airflow/blob/19ebcac2395ef9a6b6ded3a2faa29dc960c1e635/airflow/providers/amazon/aws/hooks/glue.py#L228 **So this new instance of boto3 client is using the pod ServiceAccount IAM credentials and not the provided Hook (via aws_conn_id) which are differents.** So when we are using the Operator with the verbose parameter set to True, we get this stack trace: ``` File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/amazon/aws/operators/glue.py", line 207, in execute glue_job_run = self.glue_job_hook.job_completion(self.job_name, self._job_run_id, self.verbose) File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/amazon/aws/hooks/glue.py", line 288, in job_completion ret = self._handle_state(job_run_state, job_name, run_id, verbose, next_log_tokens) File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/amazon/aws/hooks/glue.py", line 325, in _handle_state self.print_job_logs( File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/amazon/aws/hooks/glue.py", line 269, in print_job_logs continuation_tokens.output_stream_continuation = display_logs_from( File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/amazon/aws/hooks/glue.py", line 236, in display_logs_from for response in paginator.paginate( File "/home/airflow/.local/lib/python3.10/site-packages/botocore/paginate.py", line 269, in __iter__ response = self._make_request(current_kwargs) File "/home/airflow/.local/lib/python3.10/site-packages/botocore/paginate.py", line 357, in _make_request return self._method(**current_kwargs) File "/home/airflow/.local/lib/python3.10/site-packages/botocore/client.py", line 553, in _api_call return self._make_api_call(operation_name, kwargs) File "/home/airflow/.local/lib/python3.10/site-packages/botocore/client.py", line 1009, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the FilterLogEvents operation: User: arn:aws:sts::***redacted*** is not authorized to perform: logs:FilterLogEvents on resource: arn:aws:logs:***redacted***: because no identity-based policy allows the logs:FilterLogEvents action ``` ### What you think should happen instead The GlueHook should create a LogHook like in the SageMaker hook https://github.com/apache/airflow/blob/19ebcac2395ef9a6b6ded3a2faa29dc960c1e635/airflow/providers/amazon/aws/hooks/sagemaker.py#L156 that will use the Hook provided when instanciating the Operator via the aws_conn_id ### How to reproduce 1. Create an Airflow AWS Connection with a role ARN different than the one used by the Workers. 2. Execute a GlueJobOperator task with verbose parameter set to True ``` GlueJobOperator( aws_conn_id=connection_id, task_id=task_id, job_name=job_name, verbose=True, *args, **kwargs, ) ``` ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
