Skip to main content

User Scripts

About

User Scripts allow you and your users to write custom automation scripts that execute automatically during instance deployment or reinstallation. Scripts run via cloud-init and support Bash, Python 3, and PowerShell, making them ideal for automating software installation, configuration, and any post-deployment setup tasks.

Script content is encrypted at rest in the database for security. Scripts are reusable across multiple deployments and can be selected during instance creation.


Creating a Script

User Panel

  1. Navigate to User Scripts in the sidebar
  2. Click Create Script
  3. Fill in the script details:
    • Name - A descriptive name for the script (alphanumeric, spaces, dots, dashes, underscores allowed)
    • Description - (Optional) Brief description of what the script does
    • Type - Choose the scripting language:
      • bash - For Linux/Unix instances
      • python - Python 3 for Linux/Unix instances
      • powershell - For Windows instances
    • Shebang - (Optional) Custom shebang line. Defaults to #!/usr/bin/env bash for Bash or #!/usr/bin/env python3 for Python. Not applicable for PowerShell.
    • Content - Write your script in the built-in code editor with syntax highlighting

Create Script

Screenshot: User panel > User Scripts > Create Script modal showing name, description, type dropdown, shebang field, and the Ace code editor with syntax highlighting

Environment Variables

Your scripts have access to the following environment variables at runtime, automatically populated with the instance's details:

VariableDescription
PUBLIC_IPPrimary public IP address of the instance
PRIVATE_IPPrimary private IP address
VPC_IPPrimary VPC subnet IP address
INSTANCE_HOSTNAMEInstance hostname
INSTANCE_UUIDInstance UUID

Click the Insert Variables button in the script editor to automatically insert a template with all available variables.

Example Bash Script:

#!/usr/bin/env bash
apt-get update
apt-get install -y nginx
echo "Server IP: $PUBLIC_IP" > /var/www/html/index.html
systemctl enable nginx
systemctl start nginx

Example PowerShell Script:

Install-WindowsFeature -Name Web-Server -IncludeManagementTools
Set-Content -Path C:\inetpub\wwwroot\index.html -Value "Server IP: $env:PUBLIC_IP"

Managing Scripts

User Panel

The User Scripts page displays all your scripts as cards in a grid layout.

User Scripts Index

Screenshot: User panel > User Scripts page showing script cards in a grid layout with name, type badge, description, and edit/delete buttons

Each script card shows:

  • Name and Type badge (Bash, Python, or PowerShell)
  • Description if provided
  • Shebang line
  • Created date

You can Edit a script to update its content or details, or Delete it if no longer needed.

Using Scripts During Deployment

Selecting Scripts at Instance Creation

When creating or reinstalling an instance, you can select one or more user scripts to execute during deployment.

  1. During instance creation or reinstallation, locate the User Scripts field
  2. Search and select scripts from the dropdown
  3. Multiple scripts can be selected and will execute in order

Select Script on Deploy

Screenshot: Instance creation/reinstall form showing the User Scripts multi-select dropdown with script names and types listed

Cloud-Init Required

User scripts are only available for images that support cloud-init. The script selection field will only appear for cloud-init enabled images.

Execution Order

  • Scripts execute in the order they are selected
  • Each script runs to completion before the next one starts
  • Scripts execute during the cloud-init phase of instance boot, typically with root privileges on Linux or System privileges on Windows

Conclusion

User Scripts provide a straightforward way to automate post-deployment configuration without external tools. Create your scripts once, reuse them across deployments, and let cloud-init handle the execution. Combined with environment variables for dynamic values, scripts can adapt to each instance automatically.