I am attempting to execute a script on one of our instances whenever a container's state changes. I am creating a target SSM Run Command
with the document being AWS-RunShellScript (Linux)
I would have thought I could somehow pass data from the event into the script, however I cannot find a way to do so. The way I thought it could be done was using an Input Transformer
Input Path: {"lastStatus":"$.detail.lastStatus"}
Template: { "commands":["/path/to/script <lastStatus>"] }
but I get the following error
InputTemplate for target [id] contains placeholder within quotes
I was trying to not add an additional component to this with Lambda.
Best Answer
The InputTemplate value needs to be a valid JSON string. Therefore, your Input Template needs to be escaped JSON.
Here is an example of an escaped JSON string as a JSON value (taken from an aws batch state change event):