GetParametersByPath MaxResults is too low

0

Hi, Our system we store few thousands keys in the Parameter store. When we want to read all of them, to make a backup for example, it takes forever to read by 10. Usually we make 130-180 API calls.

I think, 10 is too low as MaxResults here. Could you please increase to 100? Or suggest a way to call it parallel?

https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_GetParametersByPath.html

Thanks.

asked 4 days ago29 views
1 Answer
0

I understand your concern about the low MaxResults value for the GetParametersByPath API call. However, I need to clarify that the default maximum number of results returned by GetParametersByPath is actually 10, not 100 as you mentioned.

The GetParametersByPath API call allows you to retrieve information about one or more parameters under a specified level in a hierarchy. While the default MaxResults value is indeed low for scenarios where you need to retrieve thousands of parameters, there are a couple of approaches you can consider to improve your parameter retrieval process:

  1. Increase MaxResults: You can increase the MaxResults value in your API call up to 50, which is the maximum allowed value. This will reduce the number of API calls needed, though it won't completely solve the issue for thousands of parameters.

  2. Use pagination: The GetParametersByPath API supports pagination. When you make a request, if there are more results available than the MaxResults value, the response will include a NextToken. You can use this NextToken in subsequent calls to retrieve the next set of results. This allows you to efficiently retrieve all parameters, even if it requires multiple API calls.

  3. Parallel execution: If you need to retrieve the parameters faster, you could implement a parallel execution strategy in your code. You could divide the parameter hierarchy into multiple paths and make concurrent GetParametersByPath calls for different paths. This approach can significantly reduce the overall time needed to retrieve all parameters.

  4. Consider using GetParameters: If you know the exact names of the parameters you need to retrieve, you might want to use the GetParameters API instead. This API allows you to retrieve up to 10 parameters in a single call, which could be more efficient if you don't need to traverse the entire hierarchy.

While increasing the MaxResults limit beyond 50 is not currently possible, combining these approaches - especially using the maximum allowed MaxResults value of 50 along with proper pagination and potentially parallel execution - should help you optimize your parameter retrieval process and reduce the time needed for backing up your parameters.
Sources
GetParametersByPath - AWS Systems Manager
GetParameters - AWS Systems Manager
GetParameterHistory - AWS Systems Manager

profile picture
answered 4 days ago
profile picture
EXPERT
reviewed 4 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions