Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AppConfig parameter provider #187

Closed
thomasklinger1234 opened this issue Oct 1, 2020 · 7 comments
Closed

Add AppConfig parameter provider #187

thomasklinger1234 opened this issue Oct 1, 2020 · 7 comments
Assignees
Labels
feature-request feature request help wanted Could use a second pair of eyes/hands

Comments

@thomasklinger1234
Copy link

thomasklinger1234 commented Oct 1, 2020

Is your feature request related to a problem? Please describe.
Currently, the parameter provider supports SSM, SecretsManager and DynamoDB. However, there is another configuration service which currently is not implemented: AppConfig.

Describe the solution you'd like
Create a native implementation for AppConfigProvider. It will fetch the current configuration version based on application, environment and (optionally) client configuration version. If the client is not set, it should default to POWERTOOLS_SERVICE_NAME.

NOTE For the _get_multiple function I do not have a clever semantic mapping for AppConfig. This is something that should be discussed.

For DynamoDB this is multiple items, for SSM multiple parameters. Some considerations for multiple parameters:

  • Multiple environments
  • Multiple keys extracted from the underlying JSON object in AppConfig using something like JSONpath (or JMESPath) for extracting the values

Describe alternatives you've considered
I have implemented it on my own following https://awslabs.github.io/aws-lambda-powertools-python/utilities/parameters/#create-your-own-provider but it would be nice to have this in powertools integrated.

Additional context

@thomasklinger1234 thomasklinger1234 added feature-request feature request triage Pending triage from maintainers labels Oct 1, 2020
@nmoutschen
Copy link
Contributor

Hi @thomasklinger1234 !

Sounds interesting. Thinking about how the developer experience would be like, AppConfig has a few moving parts compared to the other solutions.

To retrieve a value, AppConfig needs the following parameters: Application, Environment, Configuration and ClientId. Semantically speaking, Configuration is the configuration name to get, equivalent to the name of the parameter when we do get_parameter. However, the combination between Application/Environment/Configuration is a bit trickier.

I think Application should correspond to POWERTOOLS_SERVICE_NAME, and Environment should be the deployment environment (dev, test, prod, feat-123, etc.). This would correspond to the way these resources are created within AppConfig: you need to have an ApplicationId to create an Environment, and you need an ApplicationId too to create a configuration profile.

For ClientId, the Lambda extension for AppConfig dynamically generate a new ClientId for every Lambda execution environment. So if a function has 7 execution environment at a given time, that would be 7 different client ids.

Developer experience

So the developer experience would look like this:

from aws_lambda_powertools.utilities import parameters

appconfig_provider = parameters.AppConfigProvider(
    application="my_app", # or set through POWERTOOLS_SERVICE_NAME
    environment="feat-123",
    # Question: should we expose client_id or keep it internal?
    client_id=str(uuid.uuid4()) # or generated automatically
)

def handler(event, context):
    # Retrieve a value from AppConfig
    value = appconfig_provider.get("my-configuration")

@thomasklinger1234
Copy link
Author

@nmoutschen Sounds exactly like my thoughts! Thanks for your extensive answer.

I am willing to create a pull request for this, now that I have some initial positive feedback :)

@nmoutschen
Copy link
Contributor

Hey @thomasklinger1234 ! I'd be happy to get a PR from you on this. 😄 Happy to help if you have any question along the way as well.

@heitorlessa
Copy link
Contributor

Same here @thomasklinger1234 - We'd all be happy to help getting this implementation off the ground ;)

@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Nov 25, 2020
@heitorlessa heitorlessa added the help wanted Could use a second pair of eyes/hands label Dec 7, 2020
@ran-isenberg
Copy link
Contributor

@heitorlessa so i think i'll give it a shot. If I wont be able to finish it, i'll let you know. I need to look at the tests for the other parameters utils first.

@ran-isenberg
Copy link
Contributor

@heitorlessa @nmoutschen
#236
please take a look at the comment & code. Let me know what you think of the UX before i continue.

@heitorlessa heitorlessa added the pending-release Fix or implementation already in dev waiting to be released label Jan 17, 2021
@heitorlessa
Copy link
Contributor

hey everyone - This is now available on 1.10 on PyPi and on SAR :)

Closing this now, and thank you for @thomasklinger1234 for raising it, @risenberg-cyberark for the implementation and @nmoutschen for the support ;)

@heitorlessa heitorlessa removed the pending-release Fix or implementation already in dev waiting to be released label Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request help wanted Could use a second pair of eyes/hands
Projects
Development

No branches or pull requests

4 participants