airflow icon indicating copy to clipboard operation
airflow copied to clipboard

The AWS Secrets Backends (SM and SSM) do not allow configuration of Assume Role Methods via Backend Kwargs

Open ReadytoRocc opened this issue 3 years ago • 4 comments

Description

My current understanding, is that the methods documented here outline the ways we can authorize AWS Secrets Manager or AWS Systems Manager as a Secrets Backend. This requires managing authorization via Environment Variables or Profiles defined in an .aws/config file.

This does not include the Assume Role methods and configuration framework offered by the AWSBaseHook. I am proposing we extend the Secrets Backend integrations, so that they can be configured in a similar manner.

Use case/motivation

This would enable users to have a consistent authorization and configuration framework (with the Hooks/Operators) when connecting to AWS Secrets Backends. This could also reduce the number of cases where users need to deploy Access & Secret Keys to their Airflow environment.

For example, users could pass a Role in the BACKEND_KWARGS for the Worker or Scheduler (once authorized) to assume to connect to the service powering their Secrets Backend.

Related issues

No response

Are you willing to submit a PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

ReadytoRocc avatar Jul 27 '22 00:07 ReadytoRocc

Feel free . Also @o-nikolas and @ferruzzi and @vincbeck might want to chime-in

potiuk avatar Jul 27 '22 09:07 potiuk

This does not include the Assume Role methods and configuration framework offered by the AWSBaseHook. I am proposing we extend the Secrets Backend integrations, so that they can be configured in a similar manner.

Right now almost everything related to boto3.session.Session in Hooks managed by airflow.providers.amazon.aws.hooks.base_aws.BaseSessionFactory or Custom Session Factory. The downside of this - Factory expect Airflow Connection, and as workaround might be possible to create Fake Airflow Connection and use it for obtain credentials.

Taragolis avatar Jul 27 '22 15:07 Taragolis

@potiuk - I appreciate the ping. I'm not familiar enough with the Secrets Backend yet to have any useful opinion on this one. At face value, it sounds like a useful addition, but I can't predict any unintended side-effects at this time. :+1:

ferruzzi avatar Jul 28 '22 16:07 ferruzzi

I reviewed the linked PR #25628 and left some feedback :+1:

o-nikolas avatar Aug 11 '22 00:08 o-nikolas