Reputation: 453
I've followed kaxil answer in How to set up Airflow Send Email? to setup airflow, however gcp doesn't allow to set:
smtp_password = 16_DIGIT_APP_PASSWORD
explicity inside cloud composer. I checked on google documentation https://cloud.google.com/composer/docs/configure-email#smtp_password and found out that there is a way to set it by Using a command to retrieve an SMTP password.
smtp_password_cmd
does not appear as a key in https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html?highlight=smtp_password_cmd#smtp-password but as an environment variable, therefore is it possibile to do as suggested by the google documentation and set smtp smtp_password_cmd Specify a command that returns the SMTP password.
?Specify a command that returns the SMTP password
, if for example my smtp password is : dummypassword1
could someone provide an example of such command and how to set it inside the config?Upvotes: 3
Views: 1239
Reputation: 3955
There is an better way to do this than smtp_passwd_cmd
:
Configure Google Secrets Manager as the Airflow secrets backend
Add the SMTP password to the secrets manager.
Override the Airflow configuration for smtp_password_secret
to point to the secret you just created for this.
This is better explained here: https://cloud.google.com/composer/docs/composer-2/configure-email#using_a_secret_stored_in_to_retrieve_an_smtp_password
This way everything is just configuration.
Using Google Cloud Secret Manager for this purpose falls in the free tier for the service (see Secret Manager pricing)
Upvotes: 3