khilawar4 commented on pull request #15727:
URL: https://github.com/apache/airflow/pull/15727#issuecomment-842572598


   > Is your only reason for wanting this to support assuming roles? If so that 
feature is built in to the AWS connection and we don't need this PR to achieve 
that I think
   > 
   > See second example here 
https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/connections/aws.html#examples-for-the-extra-field
   
   I understand that airflow connection object has a option to pass iam arn so 
that aws operators can assume that arn for executing the DAG, but my point is 
not that. 
   This PR is to pass the Connection_ID value to the operator as part of XCom 
variable dynamically. (I am creating the airflow connection (i am giving the 
airflow connection name as `$run_id+$dag_id`) using my plugin and inserting the 
connection_id name in Xcom variable so that  dag remaining steps can use the 
connection_id name from XCOM variable.
   
   for example : i have below plugin code as step1 in DAG which is creating the 
airflow connection_id and setting the connection_id name in the xcom variable.
   
   `setup_aws_access = BppOperator(
           task_id='run_bpp_task',
           name="my bpp operator",
           provide_context=True
       )`
   
   now in the next steps of DAG i want to use that xcom variable to set the 
`aws_conn_id` so that this dag step can start using this new airflow connection 
for execution.
   
   example : 
   `cluster_creator = EmrCreateJobFlowOperator(
           task_id='create_job_flow', 
           aws_conn_id="{{ task_instance.xcom_pull(task_ids='setup_aws_access', 
key='aws_conn_id') }}",
           job_flow_overrides=JOB_FLOW_OVERRIDES
       )`
   
   please let me know if this explanation makes sense?


-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to