User data
Give a server start-up instructions via cloud-init, and reuse them across your servers.
User data lets you give a server instructions that it reads and carries out itself at start-up -- typically via cloud-init, to create users, install packages or write configuration files, for example. The content can be up to 32 KB, and can either be written directly when creating a server or saved as a reusable template in your user data library.
Register user data
- Select Compute > User Data Library.
- Click Register User Data.
- Enter a name and the content itself. If the content contains variables (for example
{{ ds.meta_data.variable1 }}), list them as a comma-separated list under User Data parameters -- except built-in values such aspublic_hostname, which you do not specify yourself.
You can then select this template directly when creating a new server, and fill in any variables in the dialog.
Reset user data
- Stop the server.
- Click Reset Userdata on the server.
- Either choose a saved template from your library or enter new content manually.
Using cloud-init
If cloud-init is installed in your image, user data is read automatically at start-up. From inside a running server you can always see the current content again with:
curl http://data-server./latest/user-data