Reputation: 11
I'm building an AMI using EC2 Image Builder. This AMI will later be used for some data processing. I use AWS CDK to generate the image recipe.
Now, just like when you set up a physical machine, some steps need to be run as root, but for many it is better to run them as the user that will run the actual processes for which this machine is being set up.
In principle, I could run everything as root, but it has some problems:
Therefore, ideally, I would want to choose for each command who should run it.
I've looked everywhere in the docs of AWS CDK, but haven't found anything related to switching users. I know I can do: sudo -u ec2-user do_something
, but this is just ugly (and does not always work).
Any thoughts? Has anyone else experienced this problem before?
Upvotes: 0
Views: 41