---
title: Provisioning
url: https://docs.vultr.com/products/orchestration/startup-scripts/provisioning
description: The process of setting up and configuring a new server or service to make it ready for use.
publish_date: 2024-09-23T20:21:22.381116Z
last_updated: 2025-09-29T05:02:31.004520Z
---

# How to Manage Startup Scripts for Vultr Instances

Startup Scripts for Vultr instances are files that run custom commands when your instances boot. The scripts automate repetitive tasks like installing software, configuring settings, querying third-party services, and more. These scripts are suitable when provisioning multiple Cloud Compute instances because they save time.

Follow this guide to manage Startup Scripts for Vultr Instances using the Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Orchestration** and select **Scripts**.
    1. Click **Add Startup Script**.
    1. Enter a name, select the type, define some commands, and click **Add Script**.
        
=== "Vultr API"

    1. Send a `POST` request to the [**Create Startup Script** endpoint](https://www.vultr.com/api/#tag/startup/operation/create-startup-script) and encode the Startup script to Base64 format.

        ```console
        $ curl "https://api.vultr.com/v2/startup-scripts" \
            -X POST \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "name" : "Sample-Script",
                "type" : "pxe",
                "script" : "QmFzZTY0IEV4YW1wbGUgRGF0YQ=="
            }'
        ```

        Visit the [**Create Startup Script** endpoint](https://www.vultr.com/api/#tag/startup/operation/create-startup-script) to view additional attributes to add to your request.

    1. Send a `GET` request to the [**List Startup Scripts** endpoint](https://www.vultr.com/api/#tag/startup/operation/list-startup-scripts) to view all scripts.

        ```console
        $ curl "https://api.vultr.com/v2/startup-scripts" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

=== "Vultr CLI"

    1. Create a new `scripts.yaml` file.

        ```console
        $ nano scripts.yaml
        ```

    1. Enter your Startup scripts into the file.

        ```yaml
        mkdir ~/my-apps
        chmod 700 ~/my-apps
        ```

    1. Save the file.
    1. Convert the file contents to Base64 and note the output. For instance, `bWtkaXIgfi9teS1hcHBzCmNobW9kIDcwMCB+L215LWFwcHM=`.

        ```console
        $ echo -n "$(<scripts.yaml)" | base64 
        ```

    1. Create a new Startup script.

        ```console
        $ vultr-cli script create \
        --name Sample-Script \
        --type boot \
        --script bWtkaXIgfi9teS1hcHBzCmNobW9kIDcwMCB+L215LWFwcHM=
        ```

    1. List all scripts.

        ```console
        $ vultr-cli script list 

        ```

    1. Get the details of a specific script by specifying a script ID.

        ```console
        $ vultr-cli script get script_id
        ```
    
        Run `vultr-cli script create --help` to view all options.

=== "Terraform"

    1. Create a startup script and apply.

        ```terraform
        resource "vultr_startup_script" "boot" {
            name   = "Sample-Script"
            type   = "boot"   # boot | pxe
            script = <<-EOT
              #!/bin/sh
              mkdir -p /opt/my-apps
              chmod 700 /opt/my-apps
            EOT
        }
        ```

    1. Attach the script to an instance via `user_data` or by setting `script_id`.

        ```terraform
        resource "vultr_instance" "server" {
            region = "ewr"
            plan   = "vc2-2c-4gb"
            label  = "scripted"

            # Option A: user_data cloud-init
            user_data = <<-EOT
              #cloud-config
              runcmd:
                - echo "Hello from cloud-init" > /root/hello.txt
            EOT

            # Option B: associate the startup script
            script_id = vultr_startup_script.boot.id
        }
        ```

    1. Apply the configuration and observe the following output:

        ```
        Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
        ```
