How so send arguments to SSM using the JS SDK?

Viewed 17

So I am triggering a command remotely on an EC2 instance from a lambda function using SSM in Node Typescript.

However, it is not working because I cannot pass an argument to the SSM Document in the invocation.

This is what I am trying to do:

const SSM = new SSMClient({ region: "us-east-1" });
const targetCD = target + " prod";
const sendCCParams = {
  DocumentName: 'deepblue_userflow_initiator',
  InstanceIds: ['i-0xxxxxxxxxxxxe'],
  Message: targetCD
}
const sendCC = new SendCommandCommand(sendCCParams);
const sendCCResponse = await SSM.send(sendCC); 

but the Message is not an argument from SendCommandCommandInput.

However parameters is Parameters?: Record<string, string[]>;

And my document specifies it as:

{
  "schemaVersion": "2.2",
  "description": "Initiates the deepblue-userflow controller with audit parameters",
  "parameters": {
    "Message": {
      "type": "String",
      "description": "Example",
      "default": "https://deep-blue.io prod"
    }
  },
  "mainSteps": [
    {
      "action": "aws:runShellScript",
      "name": "example",
      "inputs": {
        "runCommand": [
          "cd / && cd home/ec2-user && . .nvm/nvm.sh && cd ufo && node conductor {{Message}}"
        ]
      }
    }
  ]
}

Any time I try to pass parameters I get a {"message": "Internal server error"} response

and I can call it on the GUI enter image description here

How can I pass the parameter like in the GUI using the AWS JS SSM SDK?

0 Answers
Related