How often does the letter l occur in:
Q: How to use Input Transformer for CloudWatch Rule target SSM Run Command - AWS-RunShellScript I am attempting to execute a script on one of our instances whenever a containers 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.

A: 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):
InputPathsMap: {
    job_number : $.detail.container.environment.JOB_NUMBER,
    status : $.detail.status
},
InputTemplate: \{ \\\job\\\: \\\StatusChangeJob\\\, \\\payload\\\: { \\\job_number\\\: \\\<job_number>\\\, \\\status\\\: \\\<status>\\\ } }\


A: I dont know if you ever ended up figuring this out, but Ill 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 didnt 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 havent tested this arrangement exactly, but I have tested a similar one (what I wanted to extract was the event time), and that worked perfectly.

user
In that passage, there are 79 occurrences of the letter "l."
assistant