Configure a startup script for new Lightsail servers in WHMCS

Skip to main content
Print

Configure a startup script for new Lightsail servers in WHMCS

Use PD AWS Lightsail's User data / startup script setting to give new Linux servers a consistent initial setup. For example, a hosting company can prepare a script that installs the packages its offering requires, instead of repeating those steps after every new order.

Choose the operating-system image first

Choose the Blueprint (OS) for this offering before preparing the script. Its commands and package names must suit that image. A script prepared for one Linux distribution is not automatically suitable for another, and an application image may already include some of the software you intend to install.

If customers can choose different images at checkout, make sure your script supports each choice. Alternatively, use separate offerings with a script matched to each image.

Save the startup script

  1. Open System Settings → Products/Services → your product → Module Settings for the PD AWS Lightsail offering.
  2. Review Blueprint (OS) and the image choices available to customers.
  3. Find User data / startup script.
  4. Paste the cloud-init configuration or shell script your team has prepared and checked for that image. Leave the field blank when no startup script is needed.
  5. Save, then reopen the settings and confirm the script was retained.

The setting is used when a new instance is created. Saving it does not run the script on existing customer servers. It is not a recurring maintenance task.

Example: prepare a standard web-server offering

Suppose you sell a Linux web-server package with a fixed image. Your team prepares a first-boot script to install the required web-server packages and apply your standard initial configuration. Save that script on this offering, then verify it on the next intentional test deployment before making the offering available to customers.

This example describes the setup process; the script itself depends on the chosen image and your service requirements. Keep private deployment credentials out of a script delivered to customer-controlled servers.

Verify the result on a new service

Wait for the server to be created and for its initial setup to finish. Connect using the service's connection details and check the result your script was meant to produce: installed packages, the intended configuration and the application's actual response.

A running instance does not, by itself, prove that every script step succeeded. If the result is missing, check that the intended script was saved before this service was created and that the order selected an image it supports. Review the operating system's startup-script output for the command that needs correcting.

Know what happens during reinstall

Do not reinstall a customer's server just to test a revised startup script. The module's reinstall action replaces the operating-system disk and reapplies the service's SSH keys; it does not replay the startup script saved on the offering. Plan application setup separately when intentionally reinstalling a service.

For the other offering settings, see create a Lightsail product.

Table of Contents

Get your website online with PD Hosting

UK hosting, domains and support from a real team. From a first site to a full server.

Terms and Conditions  ·  Privacy Policy

PD Hosting is the trading name of Projektif Digital Ltd, registered in England and Wales, company number 12482555.

PD Hosting
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.