Some Airflow Configuration Options lead to broken MWAA environment

0

Creating a new MWAA env with some additional Airflow config options creates an env that's marked as "Available", but non-functioning. No env component logs are posted in CloudWatch and the Airflow UI is unreachable (returns empty response when any HTTP request is made to it). For example, when "CreateEnvironment" is called with "secrets.backend": "airflow.contrib.secrets.aws_secrets_manager.SecretsManagerBackend" in AirflowConfigurationOptions", such non-functioning MWAA env is created.

Additional observation:

When you create an MWAA env without additional config options, it comes up and is functioning. Then update the env with the config options: takes long time to finish the update, eventually the environment is running and is marked as "Available", but the configuration is unaffected. If you look at "conf.as_dict()", it shows:

"secrets": {
"backend": "",
"backend_kwargs": ""
}

There appears to be a problem with MWAA and how it handles the additional config options. Is this something MWAA team looking into? Any time frame for the resolution if so?

Edited by: levahim on Jan 11, 2021 12:04 PM

levahim
질문됨 3년 전657회 조회
4개 답변
0

Hi!

The MWAA team is working on a fix that will enable the AWS secrets manager backend and should be available soon.

Thanks!

AWS
John_J
답변함 3년 전
0

That's good news! Thanks.

levahim
답변함 3년 전
0

Hi John,

is there any ETA for the fix? I had the same issue today. It is poorly documented on AWS side and the 2+ hours updating state with Scheduler down was also very unpleasant.

Thank you in advance,
Petr

답변함 3년 전
0

Yes secrets manager is now supported.

You can use the AWS Secrets manager backend by:

  1. set the airflow configuration override secrets.backend to airflow.contrib.secrets.aws_secrets_manager.SecretsManagerBackend

  2. Add the connections/variables to AWS secrets manager, for example:
    a. for a variable called max_metadb_storage_days you would add airflow/variables/max_metadb_storage_days with a value of 14 to AWS Secrets Manager
    b. for a connection called my_db_connection you would add airflow/connections/my_db_connection with a value of 14 to AWS Secrets Manager

  3. Add AWS secrets manager read policy to your MWAA environment’s execution role

backend_kwargs is not supported, however a workaround is to override the SecretsManager function call by adding the following to your DAGs (in this case adding a "2" to the prefix):

from airflow.contrib.secrets.aws_secrets_manager import SecretsManagerBackend

def get_variable(self, key):
return self._get_secret('airflow/variables2', key)
SecretsManagerBackend.get_variable=get_variable

def get_conn_uri(self, key):
return self._get_secret('airflow/connections2', key)
SecretsManagerBackend.get_conn_uri=get_conn_uri

def get_config(self, key):
return self._get_secret('airflow/config2', key)
SecretsManagerBackend.get_config=get_config

AWS
John_J
답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠