Create a StackScript
Consider Using Akamai's New Metadata Service
Akamai's Metadata service is now available in select data centers and should be considered for new projects as an alternative to StackScripts. Use Metadata to automate system configuration by adding directives or scripts when deploying Compute Instances. This user data can then be consumed by cloud-init, an industry standard system initialization tool, or accessed directly using the Metadata API. For instructions on using the Metadata service and for a list of supported regions and distributions, reference our documentation.
This guide walks you through creating a StackScript through Cloud Manager.
- Open the Create StackScript Form in Cloud Manager
- Set the Label
- Add a Description
- Select Compatible Distribution Images
- Create the Custom Script
- Enter a Revision Note
- Save the StackScript
Open the create StackScript form in Cloud Manager
Log in to Cloud Manager and select StackScripts from the left navigation menu. Click the Create StackScript button. This opens the StackScript Create form.
Set the label
Within the Label field, enter the label you wish to use identify this StackScript. A good label should provide some indication as to what the StackScript will be used to deploy. The label must be alphanumeric, between 3 and 128 characters, and unique from other StackScript labels on your account.
Add a description
Enter a brief overview of your StackScript in the Description field, outlining what it does and any software it might be installing or configuring. If you intend on sharing this StackScript with other users on your account or making this StackScript public, this description should be sufficient to help others understand the purpose of the StackScript.
Select compatible distribution images
Within the Target Images field, select each distribution image that is compatible with your StackScript. When deploying a Compute Image based on this StackScript, the available images are limited to whichever images are selected here. At least one image must be selected, though you can add multiple images if you wish to provide an option during deployment. See Choose a Linux Distribution to learn more about the distributions that Linode supports.
Create the custom script
Paste (or type) your custom script in the Script field. This is the script that the StackScript calls when deploying a Compute Instance. The interpreter needed to execute your script must exist in the distribution images that were previously selected. The first line of the script must include a shebang followed by the path to the interpreter you wish to use.
- Bash:
#!/bin/bash
- Python:
#!/usr/bin/env python
- Python 3:
#!/usr/bin/python3
For more details on the components of a StackScript, see Write a Custom Script for Use with StackScripts guide.
Enter a revision note
Each time you make a change to a StackScript (including creating it), you can set a Revision Note to indicate what changes were made.
Save the StackScript
Once you are finished filling out all required fields, click the Create StackScript button to create the StackScript. After it has been created, you can edit all of the fields as needed. See Edit a StackScript.
To deploy a new Linode with your StackScript, follow the steps in the Deploying a New Compute Instance Using a StackScript guide.
Updated about 2 months ago