Cloud initialization scripts

Cloud initialization scripts give you the ability to run scripts when a virtual machine is provisioned.

Cloud initialization script components

Cloud initialization scripts have the following components:
The actual script that is run.
A script is a container of templates. You can use multiple templates in a script. The script name can be called from a blueprint operation or from an Image template.
Parameters are the attributes that you want to access. An attribute contains a name, a default value, and an override value.

Where cloud init scripts are used

Cloud initialization scripts are used in:
The Execute Script operations on a virtual machine in a blueprint provides a field called Script. You map the script name to this field. The script runs after the VM is provisioned. See Example: A post-provisioning cloud script in a blueprint for an example.
OS profiles
You can map a script to an OS profile.

Scripts on blueprints override scripts on image templates. Therefore, if you have a script on both components, only the script specified on the blueprint is run when the VM is provisioned. The script on the Image is ignored.

Create cloud initialization script templates and a script

Create cloud initialization templates and a script to use during VM provisioning.

Before you begin

Role required: cloud_admin


  1. Navigate to Cloud Management > Cloud Admin Portal > Design > Cloud Scripts > Cloud Script Templates.
  2. Click New.
  3. Enter the name and content of the script.
  4. Click Submit.
  5. Create as many script templates as needed.
  6. Navigate to Cloud Management > Cloud Admin Portal > Design > Cloud Scripts.
  7. Click New.
  8. Enter a descriptive name and create script that uses the template name in the following line of code:

    Where scriptName is the name of the template.

  9. Click Submit.

What to do next

To run a script at the time a virtual resource is provisioned, map the script to an OS profile. See Map scripts to an OS profile. To run a post-provisioning script, create a blueprint and specify the script in the Execute Script operation. See Example: A post-provisioning cloud script in a blueprint for an example.

Map scripts to an OS profile

You can map a script to an OS profile if you want to execute scripted actions during VM provisioning. The script runs on VMs that are created based on the image template in the OS profile.

Before you begin

  • Role required: cloud_admin
  • A cloud script that you want to run.


  1. Navigate to Cloud Management > Cloud Admin Portal > Resource Profiles > OS Profiles.
  2. On the Cloud Script OS Mappings related list, click New.
  3. Fill out the form fields (see table).
    Field Description


    Select a blueprint to limit the script to a specific resource block used in the blueprint.
    Cloud script Select that cloud script.
    Active Keep this check box selected to use the script.
    OS profile Keep the OS profile record that this script mapping is associated with.
    Resource Alias


    Select the resource block that is part of the blueprint. The script runs when a cloud resource is provisioned based on this resource block.
    Note: Profile mappings that specify more details are run first. For example, a mapping that specifies a blueprint, OS profile, and resource alias take precedence over a one that just specifies an OS profile.
  4. Right-click the form header and select Save.
    The attribute scriptName appears in the OS Profile Mapping Overrides section.
  5. In the OS Profile Mapping Overrides section, enter an optional attribute name and value that you want to use when the resource is provisioned.

Example: A post-provisioning cloud script in a blueprint

This example shows you how to create a cloud script that is run after a user provisions a virtual machine.

Before you begin

About this task

In this example, you will create a cloud init script, create a new blueprint, and provision a VM from the User Portal.


  1. Create a cloud script template and a cloud script that refers to the template.
  2. Create a blueprint with a virtual machine that can be provisioned
  3. Add these operations on the Virtual Server resource:
    • Block Until Ready
    • Execute Script: This operation tells the blueprint to run a script.
  4. For the Execute Script operation, clear the Script check box and change the expression in the Mapping column to the following text: $(CloudScript.scripts.scriptname), where scriptname is the name of the script, not the script template, that you created above.
    Figure 1. Example blueprint operations
    Example blueprint
  5. Publish the catalog item from the blueprint.
  6. Launch a new stack to provision a VM, and specify the OS profile and Compute profile you had created as a prerequisite to this example task.


The Stack Status screen runs through the CreateNode, BlockUntilReady, and ExecuteShellScript operations. The last operation is what kicked off the script you created above.