I have an SSM environment in AWS, and I have client machines that are joining without any issues. I am able to remote connect to the terminal and run commands, everything works up to this point.
Now I am trying to run terminal commands on the devices en masse. So I would like to, for example, run this:
echo 192.168.1.1 MyServer.domain.com >> /etc/hosts
apt install realmd
echo MyPassword | realm join -v --user=MyUsername domain.com
sudo reboot
So to package this script up in a tidy little unit of some kind that I can push out to devices as I require. But I can’t seem to find any way that this can be done.
2
Answers
maybe I’m misunderstanding the question, but SSM has a concept of "Documents" where you can store your scripts and supports a "Run Command" which can be used to run the document against your "fleet" of machines.
It even supports rate controls and more advanced feature.
Link for the documentation can be found here: https://docs.aws.amazon.com/systems-manager/latest/userguide/send-commands-multiple.html
you can try this script :