Overview

Pass a cloud_init script when procuring an offer to configure the instance automatically on first boot. Two formats are supported:

Cloud-config YAML

Use #cloud-config for declarative configuration — package installation, file creation, and commands:
Supported directives:
  • packages — apt packages to install
  • write_files — files to create (with optional permissions)
  • runcmd — shell commands to run after boot

Shell script

Use #!/bin/bash for full shell scripting control:

How it works

The cloud-init script is injected into the instance’s startup script. Some vendors support native cloud-init (Lambda Labs, Nebius), while others convert the script to bash commands automatically. The conversion is transparent — you always pass the same #cloud-config YAML or #!/bin/bash script regardless of vendor.
Scripts run as root and with set -e — any command failure will stop execution of remaining commands. For pip installs that may fail on older systems, use fallback patterns:

Verifying cloud-init ran

SSH into the instance and check your expected outputs:

Limitations

  • Cloud-init runs once on first boot only
  • Maximum script size varies by vendor (generally 16KB-64KB)
  • #cloud-config packages directive requires apt (Ubuntu/Debian images)
  • Some vendors may have delays between instance readiness and cloud-init completion