Skip to content

How can I setup the test connection option in MWAA

0

I'm trying to enable the test connection feature in connection tab in MWAA This is the config that I try to set in Airflow configuration UI but it's not working

webserver.test_connection = Enable webserver.test_connection = True

asked 10 months ago504 views
2 Answers
1

The above answer is not correct. The Airflow configuration mentioned in the answer controls whether users of the Airflow UI are able to view the current environment configurations.

For security reasons, Airflow by default will disable the ability to test connections from the Airflow UI. This configuration can be overridden using the Airflow configuration, AIRFLOW__CORE__TEST_CONNECTION.

This configuration has the following options:

  1. Disabled (Default value) - Fully disables test connection functionality and disables the test connection button in the Airflow UI.
  2. Enabled - Enables test connection functionality and shows the button in the Airflow UI.
  3. Hidden - Fully disables test connection functionality and hides the button in the Airflow UI.

In MWAA environments using Airflow 2.7.2 and above, this can be set either by:

  1. Setting the Airflow configuration option in a CreateEnvironment or UpdateEnvironment API call using the key value pair, Key :core.test_connection, Value : Enabled
  2. Set using the environment variable AIRFLOW__CORE__TEST_CONNECTION to Enabled using a startup script.

Airflow Connections: https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#testing-connections

Airflow Configuration Options: https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#test-connection

AWS
answered 9 months ago
0

To enable the test connection feature in the connection tab of Amazon Managed Workflows for Apache Airflow (MWAA), you need to add the correct Airflow configuration option. However, the configuration options you've tried are not correct for this purpose.

Instead, you should follow these steps to add the correct configuration:

  1. Open the Environments page on the Amazon MWAA console.
  2. Select your environment.
  3. Choose "Edit".
  4. Click "Next".
  5. In the "Airflow configuration options" pane, choose "Add custom configuration".
  6. In the dropdown list, select "webserver.expose_config" or type it if it's not available.
  7. Set the value to "True".
  8. Click "Save".

The correct configuration option is:

webserver.expose_config = True

This configuration exposes certain configurations in the Airflow UI, including the ability to test connections. After applying this change, you should be able to use the test connection feature in the connection tab of your MWAA environment.

Remember that changes to the Airflow configuration may take a few minutes to propagate throughout your environment. If you don't see the change immediately, wait a short while and then refresh the Airflow UI.

Also, keep in mind that exposing configurations can have security implications, so ensure that this aligns with your security requirements.
Sources
Using Apache Airflow configuration options on Amazon MWAA - Amazon Managed Workflows for Apache Airflow

answered 10 months ago
EXPERT
reviewed 10 months ago
  • I can see the test connection button by default but can't click them, so I try to enable it in the configuration in AWS MWAA Environment (Not via Airflow UI since it doesn't allow to change the config from UI). Even after webserver.expose_config = True I still can't test my connection

    Enter image description here

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.