Documentation Index

Fetch the complete documentation index at: https://cli.ncloud-docs.com/llms.txt

Use this file to discover all available pages before exploring further.

createInitScript

Prev Next

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)
  • 0-1024
  • Only English letter can be entered.
  • Linux: Scripts such as Python, Perl, and Shell can be used.
    • Need to specify script path on first line. (e.g., #!/usr/bin/env python, #!/usr/bin/perl, #!/bin/bash)
  • Windows: Visual Basic scripts can be used.

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
  • Automatically generated if not entered.
  • Enter 3-30 characters using a combination of English letters, numbers, and special character -.
  • The string must start with an English letter and end with an English letter or a number.
--initScriptDescription String Optional Init script description (byte)
  • 0-1000
--osTypeCode String Optional Operating system type code
  • LNX (default) | WND
    • LNX: Linux
    • WND: Windows

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"
  }
}