Install cryptography:

pip install cryptography

Generate a fernet key:

$ python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"

Paste it into your airflow.cfg.

fernet_key = 81HqDtbqAywKSOumSha3BhWNOdQ26slT6K0YaZeZyPs=

Alternatively, set the environment variable.


Restart Airflow’s webserver.

For existing connections (the ones that you had defined before setting the Fernet key), you need to open each connection in the connection admin UI, re-type the password, and save it.