Passer au contenu

AWS SecretsManager backend configuration for MWAA

0

Did anybody here manage to configure this?

Via cloudformation I can configure (same does not work in the UI due to validation):

AirflowConfigurationOptions:
secrets.backend: airflow.providers.amazon.aws.secrets.secrets_manager.SecretsManagerBackend
secrets.backend_kwargs: '{"connections_prefix": "dev/core_data/airflow/connections", "variables_prefix": null, "config_prefix": null}'

It starts up the environment and says 'available', yet something seems to go wrong because I cannot access it (gateway errors).

Am I missing another clean way to get secrets into this?

Edit: also fails if I don't use the backport providers installed from requirements.txt and just use secrets.backend: airflow.contrib.secrets.aws_secrets_manager.SecretsManagerBackend with default kwargs.

Edited by: andreaslang on Jan 6, 2021 5:17 AM

demandé il y a 6 ans2,7 k vues

11 réponses
1

Is it possible that this was resolved on 1.10.12 but not on 2.0.2? I've been running into this exact issue trying to set up the secrets manager on a 2.0.2 environment.

répondu il y a 5 ans

0

Hi!

Please try omitting the secrets.backend_kwargs entry as JSON is not currently supported for overrides.

Thanks!

AWS

répondu il y a 6 ans

0

Hi, thank you for the reply. Unfortunately that did give me the same result (gateway errors). I will double check again when I rebuild the dev environment the next time.

I also have a workaround by inheriting from the operator which needs the secret to set the config environment variables in the constructor with os.environment to enable the secrets manager backend. It is not nice, but as I just need it for one operator right now it is OK until there is a cleaner solution. Also allows me to set the prefixes.

répondu il y a 6 ans

0

Hi!

There may be an issue with the Web Server retrieving the secrets from the backend. The MWAA team is investigating and will push a fix if required.

Thanks!

AWS

répondu il y a 6 ans

0

Cool thank you, and also to confirm I tried again without kwargs and the webserver does not seem to come up if I do. Will keep using my workaround with a custom operator for now, which handles updating the backend config.

I will mark this question as answered, as we have established that I can't do what I want to do right now.

Overall though pretty happy with it MWAA in general.

répondu il y a 6 ans

0

Having same issue. Additional observations that may be helpful:

  • When you create a new MWAA env with additional Airflow config options:

{
"secrets.backend": "airflow.contrib.secrets.aws_secrets_manager.SecretsManagerBackend"
}

the environment does not come up, even though it gets the status "Available". No logs are created in CloudWatch for any of the components (scheduler, webserver, etc.), the UI webserver returns empty response when called via HTTP.

  • When you create a MWAA env without addoitional config options, it comes up. Then update the env with the config options: takes long time to finish the update, the environment is running, but the configuration is unaffected. If you look at "conf.as_dict()", it shows:

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

There's a clear problem with MWAA and how it handles this. Also, this should be a very typical use-case: I can imagine lots of folks will want to configure connections using SecretsManager or SSM Param Store in MWAA.

Edited by: levahim on Jan 8, 2021 4:00 PM

répondu il y a 6 ans

0
AWS

répondu il y a 6 ans

0

Verified. It works.

répondu il y a 6 ans

0

We've also published a new guide for this topic - Configuring an Apache Airflow connection using a Secrets Manager secret key: https://docs.aws.amazon.com/mwaa/latest/userguide/connections-secrets-manager.html.

Thanks!

AWS

répondu il y a 6 ans

0

When using backend for airflow 2.0.2, I'm still getting the same error. The env is in 'Available' state but I'm getting gateway error while accessing the airfow UI. Does that mean this is not yet resolved for 2.0.2?

répondu il y a 5 ans

0

As of 12/28/2003 I am still seeing similar errors with 2.7, creating environment succeeds bur the moment the airflow config is included the environment fails to be created after a long time in pending.

répondu il y a 3 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.