8

I am trying to query some SSM parameters by path (within Gitbash):

aws --region eu-west-2 --profile some-profile ssm get-parameters-by-path --path /prefix/prefix2

There are a number of parameters that exist which match this prefix, e.g.

/prefix/prefix2/p1
/prefix/prefix2/p2
...

I am getting the following error back:

An error occurred (ValidationException) when calling the GetParametersByPath operation: The parameter doesn't meet the parameter name requirements. The parameter name must begin with a forward slash "/". It can't be prefixed with "aws" or "ssm" (case-insensitive). It must use only letters, numbers, or the following symbols: . (period), - (hyphen), _ (underscore). Special characters are not allowed. All sub-paths, if specified, must use the forward slash symbol "/". Valid example: /get/parameters2-/by1./path0_.

I get the same error if the prefixes end in "/". What is the cause of the problem?

John
  • 10,837
  • 17
  • 78
  • 141
  • What version of the AWS CLI are you using? Can you run this command on the command line? – stdunbar Sep 11 '20 at 14:46
  • `aws --version == aws-cli/2.0.48 Python/3.7.7 Windows/10 exe/AMD64`, it's the latest version of the CLI tool. – John Sep 11 '20 at 15:15
  • 2
    Ah, it's an incompatibility with Gitbash, for some reason. Windows CMD works. – John Sep 11 '20 at 15:26
  • I just tried, and worked in my Mac too. Seems to have some problem with Gitbash. – CK__ Sep 11 '20 at 15:27
  • Just for your note, it seems to be an older [bug](https://forums.aws.amazon.com/thread.jspa?threadID=288723) which is fixed though. – CK__ Sep 11 '20 at 15:29
  • Thanks, I think the issue with Gitbash still exists as the CLI is the very latest version which is available, I've just updated and it's still an issue. – John Sep 11 '20 at 15:43
  • What if you put the path in double quotes? – stdunbar Sep 11 '20 at 15:43
  • 1
    Single quotes, double quotes, no quotes - all give the same error. – John Sep 11 '20 at 19:38

3 Answers3

5

If you're using MSYS-based bash on Windows, make sure you prefix with MSYS2_ARG_CONV_EXCL=* to prevent it from expanding /prefix/prefix2 to a windows path.

Dylan Nicholson
  • 1,301
  • 9
  • 23
4

For windows Git Bash, You need to use MSYS2_ARG_CONV_EXCL="*" in Environemnt variable (like mentioned by @Dylan Nicholson), or just use export as below

The exact code needed is as below

export MSYS2_ARG_CONV_EXCL="*"

after that you can call the command normally as below

aws ssm describe-parameters --parameter-filters "Key=Name,Values=/dev/another/path"
Tarek El-Mallah
  • 4,015
  • 1
  • 31
  • 46
3

If you are using a Windows based command use:

aws ssm get-parameters-by-path --path '//dev//another//path'

(Double slash)

That solved my issue on Windows.