17

I am getting error when I execute the below command. But as far as I have googled, I see the syntax is correct.

Command 1:

aws ssm put-parameter --name /Finance/Payroll/elixir3131 --value "P@sSwW)rd" --type SecureString

Command 2:

aws ssm put-parameter --name "/Finance/Payroll/elixir3131" --value "P@sSwW)rd" --type SecureString

for both the commands I get :

An error occurred (ValidationException) when calling the PutParameter operation: Parameter name must be a fully qualified name.

AWS CLI Version : aws-cli/1.14.16 Python/2.7.9 Windows/7 botocore/1.8.20
GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
vijaya lakshmi
  • 415
  • 1
  • 5
  • 24

6 Answers6

26

I was getting the same error using aws-sdk npm package:

ValidationException: Parameter name must be a fully qualified name.

If the Name parameter contains /, it must also start with a /.

Here is a confirmed working typescript example (assuming AWS_PROFILE and AWS_REGION env variables are set):

#!/usr/bin/env ts-node

import * as AWS from 'aws-sdk'

const secret = {
  Name: "/Finance/Payroll/elixir3131",
  Value: "P@sSwW)rd",
  Type: "SecureString"
}

const ssm = new AWS.SSM()

ssm.putParameter(secret, (err, data) => {
  if (err) {
    console.log(err, err.stack);
  } else {
    console.log(data);
  }
});

Response should look like this:

{ Version: 1, Tier: 'Standard' }
GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
15

I have had the same issue using Git-Bash on Windows 10

One way around this 'feature' is to use the --cli-input-json

e.g.

aws ssm put-parameter --cli-input-json '{"name": "/Finance/Payroll/elixir3131", "value": "P@sSwW)rd", "type": "SecureString"}'

There does seem to be some discussion about this feature/issue (and the above solution) here: https://github.com/aws/aws-cli/issues/2507

EDIT: This is the correct command:

aws ssm put-parameter --cli-input-json '{\"Name\": \"/Finance/Payroll/elixir3131d\", \"Value\": \"P@sSwW)rd\", \"Type\": \"SecureString\"}'
GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
Tim Sibley
  • 166
  • 1
  • 4
  • 1
    With the last version of AWS CLI, it works without escaping the double quotes – LionH Jan 29 '20 at 18:59
  • It works in Windows 10 Command Line prompt, without using --cli-input-json parameter at all. – ageroh Jan 19 '22 at 15:28
  • This correct for me in Jenkinsfile with sh command: aws ssm put-parameter --cli-input-json '{"Name": "${params.nome}", "Value": "${params.valor}", "Type": "SecureString"}' – Renato Souza Jun 06 '23 at 12:33
6

I know this is already marked answered, but the --cli-input-json solution didn't work for me, as I needed to pass a file name for the value and have that file's contents be read out into the parameter. For me, the issue was also in Git bash on Windows, and the problem is because Git bash tries to find anything starting with / and put a system path before it. My workaround is to enclose the name field in double quotes and put a space before the first / so that Git Bash will ignore it. Looks like this

aws ssm put-parameter --name " /my/parameter/store/path/here" --value "somevalue" --type "SecureString"
SpareTheRod
  • 476
  • 6
  • 13
1

I tried both of your commands. No problems on Windows 10 x64 Pro.

AWS Systems Manager has changed a lot recently. I would upgrade your version of the AWS CLI and try again. Your version was released on Dec-22-2017. The current version is 1.16.38 (10-19-2018).

aws-cli/1.16.15 Python/3.6.1 Windows/10 botocore/1.12.5

Installing the AWS Command Line Interface

John Hanley
  • 74,467
  • 6
  • 95
  • 159
1

None of the commands in Tim Sibley's answer worked for me, but

aws ssm put-parameter --cli-input-json '{"Name": "/Finance/Payroll/elixir3131", "Value": "P@sSwW)rd", "Type": "SecureString"}'

did.

This command is the same as the first command on that answer but with "name", "value" and "type" capitalized.

GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
RdC1965
  • 412
  • 5
  • 8
1

In Git Bash, the path is expanded for parameters that start with /, as described at Git Bash - string parameter with '/' at start is being expanded to a file path. How to stop this?

I figured this out when I looked at Cloudtrail events and saw this (redacted) when trying to run aws ssm put-parameter --name '/APPLICATION/myapp/cwagent'... (Note the name parameter):

   "requestParameters": {
        "name": "C:/Users/tony.benbrahim/AppData/Local/Programs/Git/APPLICATION/myapp/cwagent",
        "value": "HIDDEN_DUE_TO_SECURITY_REASONS",
        "type": "String",
        "overwrite": true
    },

Either solution at Git Bash - string parameter with '/' at start is being expanded to a file path. How to stop this? works, but prepending the command with MSYS_NO_PATHCONV=1 is more portable if you are writing scripts, makefiles, etc...

Tony BenBrahim
  • 7,040
  • 2
  • 36
  • 49