pythonamazon-web-servicesairflowmwaa

Unable to create new SSH connection in Apache Airflow (AWS managed MWAA)


I followed the AWS' airflow tutorial here for creating an SSH connection using the Airflow SSHOperator. However, after carefully following the steps, when I go to the UI and go to Admin->Connections->Add a New Connection the connection type SSH is not populating in the drop-down list.

'Connection Type' is missing 'SSH' option

I initially thought this had something to do with my requirements.txt file which I copied from the tutorial. The SSH example DAG did not render because of an import error and this was fixed by changing the below outdated requirements provided by the MWAA tutorial:

-c https://raw.githubusercontent.com/apache/airflow/constraints-2.2.2/constraints-3.7.txt
apache-airflow-providers-ssh

This was not compatible with my Airflow version 2.6.3 so I changed it to the below:

-c https://raw.githubusercontent.com/apache/airflow/constraints-2.6.3/constraints-3.10.txt
apache-airflow-providers-ssh

But even after more playing around with the requirements.txt file and getting the SSH DAG to render I still have no option available for SSH when creating a new connection in the GUI.

Other things I've tried: (1) waiting several hours for the Airflow environment to update, (2) booting up a new Airflow environment with the requirements available from the start and (3) rolling back to 2.4.3. The DAG rendering works but getting that SSH connection option to show up does not :(


Solution

  • So it turns out that when you're setting up Airflow MWAA with the "private" option it does not install pip dependencies on the webserver layer. This means that although the scheduler and workers have dependencies, the webserver is not able to download the SSH provider so it will not show up in the UI. You can get around this by packaging all of your own dependencies and making them available on S3 or you can reprovision your airflow instance as Public.

    It is strange that this occurs as it is not mentioned in the tutorials AWS provides around setting up the SSH operator. I found this information here: Airflow webserver not installing python requirements