-3

So i'm trying to create a SSM document with the instance ID below, so i can then link it to event bridge to trigger a powershell script based on a cloud watch alarm. I have selected Target type: /AWS::EC2::instance and then the YAML below. But it isn't letting me create the document?

---
schemaVersion: "2.2"
description: "Command Document Example JSON Template"
InstanceId: "i-0bbec63d8fee3d6e3"
description: "Instance ID"
mainSteps:
- action: "aws:runPowerShellScript"
  name: "RunCommands"
  inputs:
    runCommand:
      - "Restart-Service -Name ColdFusion 2018 Application Server"

Trying to create a SSM document, which will target this specific instance, based on this instance ID

  • What is the error exactly? – Marcin Nov 01 '22 at 00:09
  • 1 validation error detected: Value '[]' at 'targets.1.member.runCommandParameters.runCommandTargets.1.member.values' failed to satisfy constraint: Member must have length greater than or equal to 1 – John Prindesis Nov 01 '22 at 00:29

1 Answers1

0

It is not a valid SSM document file.

I believe that bellow example should help.

---
schemaVersion: "2.2"
description: "Example document"
parameters:
  Message:
    type: "String"
    description: "Example parameter"
    default: "Hello World"
mainSteps:
  - action: "aws:runPowerShellScript"
    name: "example"
    inputs:
      timeoutSeconds: '60'
      runCommand:
      - "Write-Output {{Message}}"

Source: https://docs.aws.amazon.com/systems-manager/latest/userguide/document-schemas-features.html#documents-schema-twox

ZabielskiGabriel
  • 551
  • 3
  • 12