You can use the GetParametersByPath operation to retrieve parameters by path.
You can specify a path or partial path to a parameter. The operation returns matching parameters. GetParametersByPath will recursively return parameters if you specify a path that ends in /*.
The following example will retrieve all parameters that have a Path starting with /prod:
aws ssm get-parameters-by-path --path /prod
You can also use wildcards in the path. The following example will retrieve all parameters in the /prod path:
aws ssm get-parameters-by-path --path /prod/*