The Target Key and Target Value is used to identify which instance(s) to run the command against. Target Key can either be an instance tag key (e.g.,
environment), or the literal value
InstanceIds to indicate that the command should be run against a specific list of instance IDs. Target Value is a list either of tag values, if a tag key was specified for the target key (e.g.,
production), or a list of EC2 instance IDs.
EventBridge supports fetching data out of the event and passing it to the target via Transforms. See the transforms documentation for additional details.
I have this exact same need. I have instances in an ASG that need something to happen post-boot. Specifically, I am trying to get the CodeDeploy agent installed via the SSM Document that is used by Distributor.
Its not intuitive, but the solution to this is to create an SSM Automation and not Run/Send Command. If you use an Automation then you can write the EventBridge rule to target that then use the input transform. The automation will digest the input into a Target for the automation. Not great as it adds an obfuscating layer, but it is what it is.
For my specific use case, I have also explored: Creating an EventBridge rule for each autoscaling group (yuck) Targeting the Run Command for every piece of running equipment (yuck)
Run shell script as EC2 user on Cloud formation User dataasked 5 months ago
Are EventBridge events (fully) passed to Glue Workflows?asked 8 months ago
Interactive multi-execution shellasked 10 months ago
lambda functionasked 2 months ago
How much does it cost to connect to private ec2 using aws ssm ?Accepted Answerasked 5 months ago
How to use EventBridge with Systems Manager Run Command to run shell commands?Accepted Answerasked 8 months ago
Can you use session manager to send a single command and return the output?asked 2 years ago
Run Command Missing from EC2 ConsoleAccepted Answerasked 3 years ago
How to use AWS EventBridge with Python Lambda and Boto?asked 3 years ago
On Bitnami's Jenkins Run Docker Commands in Jenkins shell ubuntuAccepted Answerasked 3 years ago