What Are Startup Scripts?
Startup scripts (cloud-init user data) run automatically when a server boots for the first time. Use them to install packages, configure services, and set up your environment without manual SSH.
Adding a Startup Script at Deploy Time
In the Deploy Server form, expand Advanced Options and paste your script in the User Data field.
Example: Install Docker and Pull an Image
>_BASH
$#!/bin/bash$set -e$$# Update system$apt-get update -y$apt-get upgrade -y$$# Install Docker$curl -fsSL https://get.docker.com | sh$$# Pull and run a container$docker pull nginx:latest$docker run -d -p 80:80 --name web nginx:latest$$echo "Setup complete" >> /var/log/startup.logExample: Configure a GPU ML Environment
>_BASH
$#!/bin/bash$set -e$$# Install CUDA$wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb$dpkg -i cuda-keyring_1.1-1_all.deb$apt-get update -q$apt-get install -y cuda-12-2$$# Install Python packages$pip3 install torch torchvision jupyterlab$$# Start Jupyter$nohup jupyter lab --no-browser --ip=0.0.0.0 --port=8888 &Viewing Script Output
>_BASH
$cat /var/log/cloud-init-output.logLimitations
| Limitation | Detail |
|---|---|
| Execution time | Scripts must complete within 30 minutes |
| Root access | Scripts run as root by default |
| One-time only | Runs on first boot only |
| Size limit | 64 KB maximum |
