When automating your infrastructure many folks use script files to manage the provisioning of resources. In Amazon Web Service (AWS) this often happens in a CloudFormation template. Within that template is almost always a UserData
section that allows the user to execute a script during the initialization process. The really nice thing is that the script has access to all sorts of environment variables, IDs, etc. The annoying thing is that the process for troubleshooting the script, especially if it’s using variables is a pain! Amazon Web Services EC2 instances write the resulting UserData script, i.e. after all variables are defined, to a location on the server instance here:
/var/lib/cloud/instances/[instance-id]/user-data.txt