Overview

User data is a script or cloud-init document handed to an instance on first boot. It is how an instance arrives configured rather than bare: packages installed, users created, services started, configuration written. There are two ways to supply it, and they behave differently.
Registered user data has no console screen. The three endpoints below work, but nothing in the interface lists, creates or selects a registered payload. To reuse one you must register it and reference it through the API.The create wizard’s own user data field is inline only — what you type there applies to that deployment and is not saved for next time.

Inline user data

Supplied as the userData field on POST /api/v1/compute/instances, base64-encoded. See Instances.
Two toggles in the create wizard’s SSH Advanced section generate cloud-init for you, and are combined with anything you supply:If you are writing your own cloud-init that sets either of these, use the toggles or your document, not both.

Registered user data

Both name and userdata are required on register.
Registered payloads can also be linked to a template, so anything deployed from that image gets them by default — POST /api/v1/templates/{id}/link-userdata. See Templates.

Writing user data that works

User data runs once, on first boot, as root, with no interactive terminal. That has consequences worth planning for:
  • A failure is silent. Nothing surfaces in the console. If an instance boots but is not configured, the payload failed, and you find out by reading /var/log/cloud-init-output.log over the console or SSH.
  • It does not re-run. Fixing a broken script and rebooting changes nothing. You need a new instance, which is why testing on one throwaway machine before a fleet is worth the minutes.
  • It cannot prompt. Any command that waits for input hangs the boot.
  • It is not a secret store. Anyone who can read instance metadata can read the user data. Never put credentials in it — fetch them at runtime instead.
Keep the payload small and idempotent: install packages, write configuration, start services. Push anything longer into a script the payload downloads, so you can fix the script without rebuilding the instance.

Virtual Machines

The create wizard and its Advanced options.

Templates

Linking a payload to an image.

The console

Reading cloud-init logs when a payload fails.

SSH Keys

The supported way to get access, rather than passwords.