James
James

Reputation: 61

Why can't this AWS SSM Run Command Document access Parameter Store parameters?

Trying to use parameters from the AWS System Manager Parameter Store in command documents continually fails. I have a simple string that I would prefer to pull from the parameter store, and yet my documents do not work with any of them.

I made this document solely to test the problem:

---
schemaVersion: "2.2"
description: "Testing Parameter Store."
parameters:
  controlString: 
    type: String
    description: "my-ecr String parameter"
    default: "{{ ssm:my-ecr }}"
mainSteps:
- action: "aws:runShellScript"
  name: "from_doc"
  description: "Prints ECR from document parameter"
  inputs:
    runCommand:
    - "echo 'Hello {{ controlString }}!'"
- action: "aws:runShellScript"
  name: "from_store"
  description: "Prints ECR from Parameter Store"
  inputs:
    runCommand:
    - "echo 'Hello {{ ssm:my-ecr }}!'"

The document can't even be saved with the second action that references the parameter directly, giving this error:

InvalidDocumentContent: SSM parameter can't be referenced inside input: echo 'Hello {{ ssm:my-ecr }}!' at Line: 16, Column: 20

So I then tried only using the first action which uses the syntax shown here in the documentation:

---
schemaVersion: "2.2"
description: "Testing Parameter Store."
parameters:
  controlString: 
    type: String
    description: "my-ecr String parameter"
    default: "{{ ssm:my-ecr }}"
mainSteps:
- action: "aws:runShellScript"
  name: "from_doc"
  description: "Prints ECR from document parameter"
  inputs:
    runCommand:
    - "echo 'Hello {{ controlString }}!'"

While this allows the document to save, the command fails with no output. Replacing the parameter with a hardcoded string works fine.

I've verified the parameter name is 'my-ecr' and it is a simple string. I've also made new parameters and tried them as well, and all fail.

Why can't these command documents use the Parameter Store parameters? When the parameters are replaced with hardcoded strings, the script works fine.

Upvotes: 0

Views: 322

Answers (0)

Related Questions