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.

Request

This section describes the request format. The method and URI are as follows:

Method URI
GET | POST /vserver/v2/createInitScript
Note

This guide is based on the GET method. POST method call tests can be performed through Swagger in the API Gateway service of the NAVER Cloud Platform console.

Request headers

For information about the headers common to all Server APIs, see Server request headers.

Request query parameters

You can use the following query parameters with your request:

Field Type Required Description
regionCode String Optional Region code
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.
    • Example: #!/usr/bin/env python, #!/bin/perl, #!/bin/bash
  • Windows: Visual Basic scripts can be used.
initScriptName String Optional Init script name
  • Enter 3 to 30 characters using a combination of lowercase English letters, numbers, and the special character "-".
  • The string must start with an English letter and end with an English letter or a number.
  • Auto-generated on no input (default)
initScriptDescription String Optional Init script description (byte)
  • 0-1000
osTypeCode String Optional Operating system type code
  • LNX (default) | WND
    • LNX: Linux
    • WND: Windows
responseFormatType String Optional Format of the response data
  • xml (default) | json

Request example

The request example is as follows:

curl --location --request GET 'https://ncloud.apigw.ntruss.com/vserver/v2/createInitScript
?regionCode=KR
&initScriptContent=%23!%2Fbin%2Fbash%20echo%20%5B1%2F5%5D%20Setting%20system%20locale%20to%20en_US.UTF-8...%20sudo%20locale-gen%20en_US.UTF-8%20sudo%20update-locale%20LANG%3Den_US.UTF-8
&initScriptName=init2
&initScriptDescription=%EC%96%B8%EC%96%B4%20%EC%84%A4%EC%A0%95%20%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8
&osTypeCode=LNX
&responseFormatType=json' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
createInitScriptResponse Object - Response result
createInitScriptResponse.requestId String - ID for the request
  • UUID format
createInitScriptResponse.returnCode String - Response code
createInitScriptResponse.returnMessage String - Response message

Response status codes

For information about the response status codes common to all Server APIs, see Server response status codes.

Response example

The response example is as follows:

{
  "createInitScriptResponse": {
    "totalRows": 1,
    "initScriptList": [
      {
        "initScriptNo": "2***6",
        "initScriptName": "init2",
        "createDate": "2025-06-20T09:40:05+0900",
        "initScriptDescription": "Language setting script",
        "initScriptContent": "#!/bin/bash echo [1/5] Setting system locale to en_US.UTF-8... sudo locale-gen en_US.UTF-8 sudo update-locale LANG=en_US.UTF-8",
        "osType": {
          "code": "LNX",
          "codeName": "LINUX"
        }
      }
    ],
    "requestId": "2ccd6246-****-****-****-8ab2725ed23e",
    "returnCode": "0",
    "returnMessage": "success"
  }
}