Available in VPC
Create an init script. An init script is a feature that allows you to automatically run a script you've written in advance when you create a server. You can create servers for the same purpose in bulk or periodically.
Syntax
The createInitScript syntax is as follows:
./ncloud vserver createInitScript \
--initScriptContent <init-script-content> \
[--initScriptName <init-script-name>] \
[--initScriptDescription <init-script-description>] \
[--osTypeCode <LNX|WND>] \
[--regionCode <KR|SGN|JPN>] \
[--output <json|xml>]
Options
This section describes the options available when running createInitScript.
Required options
The following options are required for createInitScript.
| Options | Type | Required | Description |
|---|---|---|---|
--initScriptContent |
String | Required | Init script content (KB)
|
Optional options
These are the optional options for createInitScript. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
--initScriptName |
String | Optional | Init script name
|
--initScriptDescription |
String | Optional | Init script description (byte)
|
--osTypeCode |
String | Optional | Operating system type code
|
Common options
For information about the options common to all vserver subcommands, see Server (VPC) options.
Examples
If the init script creation request is successful, the details of the created init script are returned.
Command
The command example is as follows:
./ncloud vserver createInitScript \
--initScriptContent "#!/bin/bash
echo \"Hello from init script\"
sudo apt-get update -y" \
--initScriptName test-init-script-01 \
--initScriptDescription "Test init script for documentation" \
--osTypeCode LNX \
--regionCode KR \
--output json
Output
The output example is as follows:
{
"createInitScriptResponse": {
"totalRows": 1,
"initScriptList": [
{
"initScriptNo": "12345678",
"initScriptName": "test-init-script-01",
"createDate": "2026-05-14T14:08:35+0900",
"initScriptDescription": "Test init script for documentation",
"initScriptContent": "#!/bin/bash\necho \"Hello from init script\"\nsudo apt-get update -y",
"osType": {
"code": "LNX",
"codeName": "LINUX"
}
}
],
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"returnCode": "0",
"returnMessage": "success"
}
}