-
Notifications
You must be signed in to change notification settings - Fork 402
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
Feature request: Support for retrieving batch of secrets #4200
Comments
FYI @aws-powertools/lambda-dotnet-core @aws-powertools/lambda-typescript-core @aws-powertools/lambda-java-core |
Thanks for opening this @heitorlessa. We will try to add this in v3. |
Hey @heitorlessa, @hjgraca, @am29d and @dreamorosi, I have a few questions here and would like to discuss the best customer experience with you. This will make it easier to implement in other runtimes. Function parameters - Name or ARN?After examining the implementations in Python, JavaScript, and .NET AWS SDK, I found that they all implement two parameters in def _get_multiple(self, names: List[str], **sdk_options) -> Dict[str, str]:
if not names:
raise GetSecretError("You must inform at least one name.")
sdk_options["Filters"] = [{"Key": "name", "Values": names}]
secrets_result = boto3.client("secrets").batch_get_secret_value(**sdk_options) Do we iterate and return all values, or do customers handle pagination on their end?By default, this operation does not automatically allow to paginate results using SDK. This means that when you call this operation for the first time, if the number of items in AWS Secrets exceeds the limit defined by For now, these are the two questions that are blocking the start of work here. Thanks |
Hey thanks for the thoughtful proposal and for tagging us. Regarding the first point, I agree with you, most people won't use the ARN so I agree with your idea of using filters. I would however propose to merge the const filters = [...sdk_options.Filters, {"Key": "name", "Values": names}]
// use `filters` in the next line This way customers can have an escape hatch to pass additional filters if the name is too ambiguous, for example: secrets.get_multiple(names=["foo/bar", "foo/baz"], sdk_options=[{"Key": "primary-region", "Values": "eu-west-1"}]) Which would then get merged to: const filters = [{"Key": "primary-region", "Values": "eu-west-1"}, {"Key": "name", "Values": names}] -- For the second point, I agree with you and we should align with what we do already for the SSMProvider and fetch everything before returning. |
Great point @dreamorosi! This way the customer can search using the name as a filter and any other field they want. Thanks for the contribution.. I'll start working on this today. |
Do not forget when creating documentation: When using this approach of concatenating filters ( |
Removing this from the initial V3 release, but planned to add after the official release. |
Use case
Have the same experience as SSM but Secrets Manager now that it's possible.
It was quietly launched recently: https://aws.amazon.com/about-aws/whats-new/2023/11/aws-secrets-manager-batch-retrieval-secrets/
Solution/User Experience
Same experience as
get_parameters_by_name
, as each secret might have a different TTL associated with it: https://docs.powertools.aws.dev/lambda/python/latest/utilities/parameters/#getting_started_parameter_by_namepyAlternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: