{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "name": "Startup scripts | Edge Compute Docs",
  "headline": "Startup scripts | Edge Compute Docs",
  "description": "Automate VM setup with startup scripts. Use pre-built Edge library scripts or write your own to install software and configure services on first boot.",
  "url": "https://edge.network/docs/compute/scripts",
  "image": "https://edge.network/og/docs__compute__scripts.png",
  "inLanguage": "en",
  "publisher": {
    "@type": "Organization",
    "name": "Edge Network",
    "url": "https://edge.network",
    "logo": "https://edge.network/favicon.svg"
  },
  "isPartOf": {
    "@type": "WebSite",
    "name": "Edge Network",
    "url": "https://edge.network"
  },
  "breadcrumb": {
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Home",
        "item": "https://edge.network"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "Docs",
        "item": "https://edge.network/docs"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "Compute",
        "item": "https://edge.network/docs/compute"
      },
      {
        "@type": "ListItem",
        "position": 4,
        "name": "Scripts",
        "item": "https://edge.network/docs/compute/scripts"
      }
    ]
  },
  "section": "documentation/compute",
  "articleBody": "Docs CDN Deployments, domains, caching, purging and on-the-fly image optimisation. Getting started \n Deployments \n Domains & SSL \n Compute Virtual machines in seconds: networking, firewalls, backups and SSH keys. Getting started \n Creating VMs \n Managing VMs \n DNS Zones, records, geo-routing, backups and development domains. Getting started \n Zone management \n DNS records \n Storage S3-compatible buckets, access keys, presigned URLs and multipart uploads. Getting started \n Buckets \n Access keys \n Shield Privacy-first bot protection: widget modes, siteverify and verified agents. Getting started \n Widget modes \n JavaScript API \n Assist AI answers from your own content: widget, ingestion and the API. Getting started \n Widget & embedding \n Content ingestion \n REST API Manage every Edge resource over HTTPS with API keys. Authentication \n Errors \n Versioning \n Compute \n CDN \n DNS \n CLI One binary for macOS, Linux and Windows to script every product. Installation \n Authentication \n Compute commands \n CDN commands \n DNS commands \n Storage commands \n Dev tooling Command palette and keyboard shortcuts across the console. Command palette \n Agent tooling Let AI agents deploy and manage infrastructure: discovery, MCP and access codes. Start with the overview MCP server \n MCP tool reference \n Connect your tool \n Framework wrappers \n Self-signup \n Access codes \n Discovery endpoint \n Deploy a static site \n Deploy an app \n Projects \n Bot protection \n AI answers \n Account & support Teams, security, audit logs, alerts, billing tools and support. Start with the overview Teams \n Referral programme \n Cost Advisor \n Security \n Two-factor auth \n Audit log \n Alerts \n Support tickets \n Search the docs ⌘K Console Products\n\n CDN Compute Overview Getting started Creating VMs Managing VMs Networking Firewall SSH keys Startup scripts Backups Monitoring DNS Storage Shield Assist Developer tools\n\n REST API CLI Dev tooling Agents\n\n Agent tooling Account\n\n Account & support How it works Copy Anchor Link \n\n Startup scripts execute once, automatically, when a VM first boots. They run as root via the guest agent, so no SSH connection is required. Scripts have a 10-minute timeout, and their output is captured for debugging.\n\n Select a script when creating a VM.\n The VM boots and the OS installs.\n The script runs automatically.\n Edge script library Copy Anchor Link \n\n Pre-built, tested scripts maintained by Edge. Available to all users out of the box.\n\n Web servers and stacks Copy Anchor Link \n\n Script Description Parameters LAMP Stack Apache, MySQL 8, PHP 8.3 db_password LEMP Stack Nginx, MySQL 8, PHP 8.3-FPM db_password Node.js Node.js 22 LTS, PM2, Nginx reverse proxy node_version Python Python 3.12, pip, Gunicorn, Nginx None Applications Copy Anchor Link \n\n Script Description Parameters WordPress Nginx, MySQL, PHP-FPM, WP-CLI site_title , admin_email , db_password Docker Docker CE, Docker Compose None Development tools Copy Anchor Link \n\n Script Description Parameters PostgreSQL PostgreSQL 16, remote access configured db_password , db_name Redis Redis 7, password auth, AOF persistence redis_password Security Copy Anchor Link \n\n Script Description Parameters Hardened SSH Disable password auth, fail2ban, UFW None Using a script when creating a VM Copy Anchor Link \n\n Navigate to Compute → Create VM .\n Configure your VM as usual (region, OS, resources, SSH keys).\n In the Startup Script section, select a script from the dropdown.\n If the script has parameters, fill them in (passwords are auto-generated if left blank).\n Click Create VM .\n The script runs automatically once the VM finishes provisioning. You can check its status on the VM detail page.\n\n Tip\n\n Scripts run before SSH is available. Your VM&#x27;s software will be ready by the time you connect.\n\n Creating custom scripts Copy Anchor Link \n\n Create your own scripts to automate any setup you need.\n\n Go to Compute → Scripts .\n Switch to the My Scripts tab.\n Click Create Script .\n Write your bash script and optionally define parameters.\n Click Save . Your script is now available in the VM creation dropdown.\n Script guidelines Copy Anchor Link \n\n Start with #!/bin/bash and set -e : exit on error so failures are caught and reported.\n Log progress with echo : output is captured and visible on the VM detail page.\n Use export DEBIAN_FRONTEND=noninteractive : prevents apt from prompting for input during package installation.\n Keep it under 10 minutes: scripts are killed after 10 minutes. For longer setups, have the script kick off a background task.\n Parameters Copy Anchor Link \n\n Use the ${param_name} syntax in your script. When the VM is created, parameter values are substituted before execution.\n\n Terminal Copy Text #!/bin/bash \n set -e \n \n DB_PASSWORD =\" ${db_password :- $( openssl rand -base64 16 ) } \" \n \n echo \" Setting up database with password: $DB_PASSWORD \" \n # ... your setup logic ... The :-default syntax provides a fallback if the parameter is empty.\n\n Checking execution status Copy Anchor Link \n\n After creating a VM with a startup script, you can monitor its progress on the VM detail page.\n\n Pending: the VM is still provisioning and the script is queued\n Running: the script is executing inside the VM\n Completed: the script finished successfully\n Failed: the script encountered an error (click View output for details)\n Managing scripts from the CLI Copy Anchor Link \n\n The full script workflow is available in the Edge CLI . You can list the library, manage your custom scripts and attach a script when creating a VM.\n\n Terminal Copy Text # Browse available scripts (Edge library + your own) \n edge compute scripts list \n \n # Create a custom script from a file \n edge compute scripts create --name \" My Setup \" --file setup.sh \n \n # Run a script on a new VM, with parameters \n edge compute create --name blog --size s-2vcpu-4gb --image ubuntu-24 \\ \n --region london --script wordpress \\ \n --script-param site_title= \" My Blog \" \\ \n --script-param admin_email=me@example.com See the CLI compute commands reference for all script commands.\n\n API and agent access Copy Anchor Link \n\n Startup scripts can also be used via the API and the AI agent.\n\n Inline script (API/agent) Copy Anchor Link \n\n Pass a script directly when creating a VM using the setup_script field:\n\n HTTP Copy Text POST /agent/compute/vms \n { \n \" name \": \" my-server \", \n \" size \": \" small \", \n \" setup_script \": \" #!/bin/bash\\nset -e\\napt update && apt install -y nginx \" \n } Using a library script by ID (agent) Copy Anchor Link \n\n Agents can list available scripts with GET /agent/compute/scripts and reference one by ID. Parameter substitution happens server-side:\n\n HTTP Copy Text POST /agent/deploy/app \n { \n \" project \": \" my-blog \", \n \" compute \": { \n \" size \": \" small \", \n \" script \": \" wordpress \", \n \" script_params \": { \" site_title \": \" My Blog \", \" admin_email \": \" me@example.com \" } \n } \n } The same script / script_params fields work on POST /agent/compute/vms .\n\n Checking status Copy Anchor Link \n\n HTTP Copy Text GET /api/compute/vms/{vm_id}/scripts \n \n { \n \" executions \": [ \n { \n \" id \": \" ... \", \n \" script_name \": \" setup_script \", \n \" status \": \" completed \", \n \" output \": \" === Docker Installed ===\\nDocker: Docker version 27.4... \", \n \" started_at \": \" 2026-03-03T00:15:00Z \", \n \" completed_at \": \" 2026-03-03T00:17:34Z \" \n } \n ] \n } Troubleshooting Copy Anchor Link \n\n Script shows \"Failed\" Copy Anchor Link \n\n Click View output on the VM detail page to see the error.\n Make sure your script starts with #!/bin/bash .\n Check that all package names are correct for the selected OS.\n Ensure DEBIAN_FRONTEND=noninteractive is set for apt commands.\n Script still \"Pending\" after the VM is running Copy Anchor Link \n\n Scripts are executed shortly after the VM reaches \"running\" status. Allow up to 30 seconds for the guest agent to initialise. If the status doesn&#x27;t change, the guest agent may not be available. Try restarting the VM.\n\n Script timed out Copy Anchor Link \n\n Scripts are ...",
  "headings": [
    {
      "level": 1,
      "text": "Startup scripts"
    }
  ],
  "relatedLinks": [
    {
      "@type": "WebPage",
      "name": "Network",
      "url": "https://edge.network/network"
    },
    {
      "@type": "WebPage",
      "name": "Pricing",
      "url": "https://edge.network/pricing"
    },
    {
      "@type": "WebPage",
      "name": "Docs",
      "url": "https://edge.network/docs"
    },
    {
      "@type": "WebPage",
      "name": "Sign in",
      "url": "https://edge.network/console/access"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/cdn/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Deployments",
      "url": "https://edge.network/docs/cdn/deployments"
    },
    {
      "@type": "WebPage",
      "name": "Domains &amp; SSL",
      "url": "https://edge.network/docs/cdn/domains"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/compute/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Creating VMs",
      "url": "https://edge.network/docs/compute/creating-vms"
    },
    {
      "@type": "WebPage",
      "name": "Managing VMs",
      "url": "https://edge.network/docs/compute/managing-vms"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/dns/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Zone management",
      "url": "https://edge.network/docs/dns/zones"
    },
    {
      "@type": "WebPage",
      "name": "DNS records",
      "url": "https://edge.network/docs/dns/records"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/storage/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Buckets",
      "url": "https://edge.network/docs/storage/buckets"
    },
    {
      "@type": "WebPage",
      "name": "Access keys",
      "url": "https://edge.network/docs/storage/access-keys"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/shield/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Widget modes",
      "url": "https://edge.network/docs/shield/widget-modes"
    },
    {
      "@type": "WebPage",
      "name": "JavaScript API",
      "url": "https://edge.network/docs/shield/js-api"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/assist/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Widget &amp; embedding",
      "url": "https://edge.network/docs/assist/widget"
    },
    {
      "@type": "WebPage",
      "name": "Content ingestion",
      "url": "https://edge.network/docs/assist/ingestion"
    },
    {
      "@type": "WebPage",
      "name": "Authentication",
      "url": "https://edge.network/docs/api/authentication"
    },
    {
      "@type": "WebPage",
      "name": "Errors",
      "url": "https://edge.network/docs/api/errors"
    },
    {
      "@type": "WebPage",
      "name": "Versioning",
      "url": "https://edge.network/docs/api/versioning"
    },
    {
      "@type": "WebPage",
      "name": "Compute",
      "url": "https://edge.network/docs/api/compute"
    },
    {
      "@type": "WebPage",
      "name": "CDN",
      "url": "https://edge.network/docs/api/cdn"
    },
    {
      "@type": "WebPage",
      "name": "DNS",
      "url": "https://edge.network/docs/api/dns"
    },
    {
      "@type": "WebPage",
      "name": "Installation",
      "url": "https://edge.network/docs/cli/installation"
    },
    {
      "@type": "WebPage",
      "name": "Authentication",
      "url": "https://edge.network/docs/cli/authentication"
    }
  ],
  "alternateFormats": [
    {
      "@type": "MediaObject",
      "contentType": "text/html",
      "url": "https://edge.network/docs/compute/scripts",
      "name": "HTML version"
    }
  ],
  "dateModified": "2026-11-23T02:00:49.268Z"
}