llms.txt: machine-readable documentation index. Markdown version of this page is also available.

Iqbal´s DLQ Help

AWS SSM - Run Script On Remote EC2

To run a script on a remote EC2 instance that has the SSM agent installed, you can use the AWS Systems Manager Run Command feature:

export SCRIPT_CONTENT=$(cat ec2_script.sh) aws ssm send-command --profile "$AWS_PROFILE" --document-name "AWS-RunShellScript" \ --targets "Key=InstanceIds,Values=$INSTANCE_ID" \ --parameters "commands=[' export VAR_1=VAR_1_VALUE; export VAR_2=VAR_2_VALUE; cat > /path/at/destination/ec2/ec2_script.sh << \"EOF\" $SCRIPT_CONTENT EOF chmod +x /path/at/destination/ec2/ec2_script.sh /path/at/destination/ec2/ec2_script.sh']"
23 October 2026