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 |
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)
|
initScriptName |
String | Optional | Init script name
|
initScriptDescription |
String | Optional | Init script description (byte)
|
osTypeCode |
String | Optional | Operating system type code
|
responseFormatType |
String | Optional | Format of the response data
|
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
|
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"
}
}