Background
I want to automatically configure an EC2 via a build, using the aws cli and ssm.
The (manual) setup for the container looks something like this:
- Create an EC2
- Run a shell script as root
- Run a shell script as a specific user
Question
Is it possible to run a command on an ec2 utilising a tool such as aws ssm send-command
specifying the linux user which will execute the command?
Assuming the command is a shell script, would specifying the user inside the script do the same job? e.g using sudo su my_user
sudo
when you're alreadyroot
is superfluous. Justsu
and then do stuff as that user. stackoverflow.com/a/3420291/2002471