John
John

Reputation: 11921

Why am I getting an error when querying SSM parameters via get-parameters-by-path?

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?

Upvotes: 8

Views: 27698

Answers (4)

Spencer Sutton
Spencer Sutton

Reputation: 3427

In my case I was missing a beginning slash.

I had: mydeployid/my/path/value

And that gave me this error. The text in the error is misleading, I just had to change it to: /mydeployid/my/path/value

Upvotes: 3

Tarek El-Mallah
Tarek El-Mallah

Reputation: 4115

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"

Upvotes: 5

Pepe El Toro
Pepe El Toro

Reputation: 31

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.

Upvotes: 3

Dylan Nicholson
Dylan Nicholson

Reputation: 1378

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.

Upvotes: 7

Related Questions