It is possible to add user data scripts to be ran during cloud init of a VM when it first starts.
To add your own scripts to a given VM, make sure that cloud init is installed on the VM, and then do the following:
- Open the VM Editor for the given VM.
- Select the “configuration management” tab.
- Check the box at the top that states that cloud init is installed on the VM.
- Add your script to the user data section below.
Here are some examples of scripts that can be added as user data:
echo ‘my_script' > /tmp/my_script
- source: "ppa:smoser/ppa”