Expected Behaviour
Given SSM parameters:
/foo/bar/param1
/foo/bar/param2
/foo/bar/param3
Calling parameters.get_parameters("/foo/bar") should return a dictionary of all 3 parameters.
Calling parameters.get_parameter("/foo/bar") should ALWAYS raise a GetParameterError. This error should be raised even if the get_parameter call comes after the get_parameters call.
Current Behaviour
Given the same parameters as above:
If I call parameters.get_parameters("/foo/bar") all 3 parameters are cached under the parameter /foo/bar and returned as a dictionary.
If I subsequently call parameters.get_parameter("/foo/bar") it returns the same dictionary as the get_parameters call instead of raising the GetParameterError.
Code snippet
# Update paths below to PATH of actual SSM parameters in your account and not parameter NAMES.
from aws_lambda_powertools.utilities import parameters
print(parameters.get_parameters(path="/foo/bar"))
print(parameters.get_parameter("/foo/bar"))
Possible Solution
- Cache
get_parameter results separately from get_parameters results.
- Note in the cache whether the values being cached are from
get_parameter or get_parameters.
Steps to Reproduce
- Add multiple SSM parameters to parameter store under the same path.
- Run Code Snippet above referencing the SSM parameters' path.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.9
Packaging format used
Lambda Layers
Debugging logs
No response
Expected Behaviour
Given SSM parameters:
/foo/bar/param1/foo/bar/param2/foo/bar/param3Calling
parameters.get_parameters("/foo/bar")should return a dictionary of all 3 parameters.Calling
parameters.get_parameter("/foo/bar")should ALWAYS raise aGetParameterError. This error should be raised even if theget_parametercall comes after theget_parameterscall.Current Behaviour
Given the same parameters as above:
If I call
parameters.get_parameters("/foo/bar")all 3 parameters are cached under the parameter/foo/barand returned as a dictionary.If I subsequently call
parameters.get_parameter("/foo/bar")it returns the same dictionary as theget_parameterscall instead of raising theGetParameterError.Code snippet
Possible Solution
get_parameterresults separately fromget_parametersresults.get_parameterorget_parameters.Steps to Reproduce
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.9
Packaging format used
Lambda Layers
Debugging logs
No response