I don't know if you ever ended up figuring this out, but I'll post my solution for anyone else who runs across this question while googling.
I ended up creating a custom command document with an extra parameter specifically for the value I was interested in. That way I didn't have to quote the placeholder when specifying it in the template, I could just pass it directly. Example, based on the existing RunShellScript command document:
{
"schemaVersion": "2.2",
"description": "Pass previous status to local script.",
"parameters": {
"scriptPath": {
"type": "String",
"descripton": "(Required) The absolute path to the local script.",
"maxChars": 4096
},
"lastStatus": {
"type": "String",
"description": "The previous status of the container.",
"maxChars": 100
}
"workingDirectory": {
"type": "String",
"default": "",
"description": "(Optional) The path to the working directory on your instance.",
"maxChars": 4096
},
"executionTimeout": {
"type": "String",
"default": "3600",
"description": "(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (48 hours).",
"allowedPattern": "([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)"
}
},
"mainSteps": [{
"action": "aws:runShellScript",
"name": "runShellScript",
"inputs": {
"runCommand": [
"{{ scriptPath }} '{{ lastStatus }}'"
],
"workingDirectory": "{{ workingDirectory }}",
"executionTimeout": "{{ executionTimeout }}"
}
}]
}
Then you can just set "lastStatus": "$.detail.lastStatus"
in the input path, and {scriptPath: "/path/to/script", "lastStatus": <lastStatus>}
(note the absence of quotes) in the template, and you should be good to go.
I haven't tested this arrangement exactly, but I have tested a similar one (what I wanted to extract was the event time), and that worked perfectly.