AWS User Data Syntax and Supported Variables
User data allows you to configure an AWS VM during provisioning, or to run a configuration script on a VM. User data allows you to, for example:
- Customize the deployed VM's host name during provisioning.
- Run scripts after the VM starts and perform common automated configuration tasks.
- Enable CloudWatch monitoring for new VMs.
With Commander, you can add user data:
- To an AWS service catalog component; the user data is then applied during deployment of a service request.
- When manually deploying an AWS VM from a template.
Syntax for AWS user data
Both scripts and cloud-init directives are supported.
User data is limited to 16 KB. For longer user data, point to a script file instead.
New lines and carriage returns are preserved.
Unicode characters are not supported.
You can use Commander variables in the User Data field; see the next section for details.
Escaping variables isn't supported; variables are substituted when valid within the current context.
Commander doesn't perform user data input validation, aside from Commander variables. Consult the Amazon EC2 documentation for more information on prerequisites and syntax:
Using variables in AWS user data
Only a few variables are supported when manually deploying an AWS template. If you use variables that are supported only in the service catalog user data when manually deploying an AWS template, the variables will be passed as text (they won't be substituted).
In any text field that supports variables, click to open the script editor and select variables for the current context.
Verifying the application of user data after deployment
Note that once the user data is passed to AWS during deployment, Commander doesn't provide feedback on the success or failure of the configuration process. The following information was valid at time of publication; consult the AWS documentation for more information troubleshooting customization with user data.
Linux
For Linux, the cloud-init log file (found at /var/log/cloud-init.log
) captures console output, allowing you to debug your scripts if the VM isn't configured as intended.
Windows
The AWS user data log can be found on the deployed VM at:
C:\<Program Files>\Amazon\Ec2ConfigService\Logs\Ec2ConfigLog.txt
AWS user data (.bat and PowerShell scripts) are stored here on the deployed VM:
C:\Program Files\Amazon\Ec2ConfigService\Scripts
You can check whether the user data has been imported correctly by browsing to this URL on the deployed VM:
http://169.254.169.254/latest/user-data