Submit user data
Metadata is a service that enables a ccloud³ VM to retrieve data about itself. You can also use metadata to provide user data when creating a ccloud³ VM, thereby simplifying or automating the set-up process.
Prerequisites
- Access to the centron Control Panel
About user data
User data is any data – usually a script – that you can provide whilst creating a ccloud³ VM. If CloudInit is available on the ccloud³ VM, it processes the user data, which it can use to perform tasks as the root user during the ccloud³ VM’s first boot.
CloudInit accepts Cloud Config files or any script that can be interpreted by the new ccloud³ VM, such as a Bash script. CloudInit is available on the latest Ubuntu and CentOS images from centron. You can define user data for images that do not support CloudInit, but this will not be processed automatically on first boot.
Provision of user data
You can provide user data when creating a ccloud³ VM via centron, Control Panel, the API, doctl or the CLI client.
-
About the centron Control Panel: On the page for creating the ccloud³ VM, click ‘+ Advanced options’ above the ‘Final details’ section. In the section that opens, tick the box next to ‘Add initialisation scripts’. Paste your user details into the field that appears.
-
About the centron API: Use the
user_datafield in the POST request to create the ccloud³ VM. -
About doctl: Use the
--user-dataor--user-data-fileflags when callingdoctl compute ccloud create.
User data cannot be changed once a ccloud³ VM has been created.
Debugging user data
To see how a CloudInit file uses the provisioned user data, take a look at the /var/log/cloud-init-output.log file:
- Command:
cat /var/log/cloud-init-output.log | grep userdata
This file logs the output from CloudInits, allowing you to view warnings, error messages or debug information.