User Data is a feature that enables the addition of scripts or data to your instances during launch.
The scripts can be used to automate tasks, install software, or customize settings.
This tutorial provides a step-by-step walkthrough on how to create a VM with User Data in Outscale
using CloudBolt Cloud Management Platform.
Set Parameters
In the Environment Parameters tab, add "Outscale User Data"
In the Environment "OS Builds" tab, add "Ubuntu-22.04-2023.02.21-0" or any other image that supports User Data.
    
Not all OS Builds support User Data.
From AWS documentation, the image must be Amazon Linux 2 AMI.
User Data may not work for other Linux distributions.
Amazon recommends reviewing the specific distribution specs to determine if user data is supported.
In this example we use Ubuntu-22.04-2023.02.21-0.
Add User Data and submit blueprint order
In the Server Blueprint select Outscale environment and the supported OS Build.
Enter User Data script and submit order.
Example script:
#cloud-config
runcmd:
- echo "==================== $(date) ======================"
- echo "Running user data cloud-config. CAT team was here =^..^="
- echo "================================================"
Access instance console output in the Outscale web portal
Click "CONSOLE OUTPUT"
The console output will display boot process and initialization of the new instance. Refresh the console to monitor progress and wait for the cloud-init to execute.
It may take several minutes before the user data script output becomes visible in the console.
Verify the script output appears in the console
Predefined Environment Parameter Option
    
Instead of specifying user data at the time the order is placed, it can be predefined at the Environment level.
First, add the script as an Environment level parameter option.
Then enter the User Data script in the Options form that appears.
Next, configure the blueprint to use the predefined "Outscale User Data" parameter.
Select the predefined user data script from the drop-down list.
Create another blueprint order and note that the User Data field is now hidden from the blueprint.
Submit the blueprint order and confirm script execution in the Outscale console:
Passing Server variables
    
Server variables can be included in the script. CloudBolt will replace server variables inside the double
curly brackets with their values.
Inside instances, the user data script is copied and executed from the /var/lib/cloud/instances/<instance id>/
directory. The log is stored in the /var/log/cloud-init-output.log.