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:

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 is not 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).

Clicking vars-20x20 in any text field that supports variables opens the Variable Assistant, which allows you to select variables for the current context and provides help for each variable.

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 is not 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