Search code examples
dockerairflowmwaa

How to update airflow.cfg file in MWAA local Runner


I need to update the airflow configuration file (usr/local/airflow/airflow.cfg) in my Docker image running MWAA-Local-Runner.

However, the changes I do when editing the file from my host computer are not reflected when restarting the environment using ./mwaa-local-env start command


Solution

  • You can create a .env file (for example .env.localrunner) and set variable via airflow env varaibles convention (AIRFLOW__SECTION__VARIABLE)

    for example if I want to change the webserver instance_name to "DEV" i can add the following to my .env.localrunner file

    AIRFLOW__WEBSERVER__INSTANCE_NAME=DEV
    

    or if you need to set AIRFLOW__SECRETS__BACKEND_KWARGS you can :

    AIRFLOW__SECRETS__BACKEND_KWARGS={"connections_prefix": "airflow/connections", "region_name": "aws_region"}

    in the docker-compose that you run your local-mwaa add the following under local-runner in order to read those variables.

        env_file:
      - .env.localrunner