I have a string parameter for AWS SSM CLI command that looks like a path to a file due to starting with a /
. /path/to/my/param
.
When I run the command on git bash it tries to find the file instead, no matter how I try to escape it:
aws ssm get-parameter --name "/path/to/my/param"
aws ssm get-parameter --name '/path/to/my/param'
aws ssm get-parameter --name '\/path\/to\/my\/param'
An error occurred (ValidationException) when calling the GetParameter operation: Invalid label format /Program Files/Git/path/to/my/param. A label name can't be prefixed with numbers, "ssm", or "aws" (case-insensitive). You can specify letters, numbers, and the following symbols: period (.), dash (-), or underscore (_).
Even tried back-ticks, then I get a bash error
aws ssm get-parameter --name `/path/to/my/param`
Error: bash: /path/to/my/param: No such file or directory
If I do echo /asd/asd
it actually outputs /asd/asd
, so it also might be how the aws cli is treating the input.
Any ideas how to escape it?
It is possible to turn off a path conversion in MSYS2 for selected paths (see Msys2 Porting, Filesystem namespaces section).
You can also disable it temporarily in the following way:
MSYS2_ARG_CONV_EXCL="/aws" aws ssm get-parameter --name '/aws/path/to/my/param'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With