CreateImage
1. API Description
This API is used to create a custom image from an instance.
2. Input Parameters
The following request parameter list only provides API request parameters.
instanceId
Yes
String
Instance ID from which you create the image.
imageName
Yes
String
Image name. This parameter must start with a number or a letter, containing 2 to 63 characters. Only letters, numbers, -/_ and periods (.) are supported.
resourceGroupId
No
String
Resource group ID where the image reside.
If the value is empty, the image will be added into the default resource group.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
imageId
String
Image ID.
imageName
String
Image name.
4. Code Example
Create a custom image from an instance.
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateImage
<Common Request Params>
Request:
{
"instanceId": "<instance id>",
"imageName": "imageXXX"
}
Response:
{
"requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
"response": {
"requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
"imageId": "imageIdX",
"imageName": "imageNameX"
}
}
5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
400
INVALID_IMAGE_QUOTA_EXCEED
Quota limit of custom image is exceeded.
404
INVALID_INSTANCE_NOT_FOUND
Instance does not exist.
400
OPERATION_DENIED_GPU_INSTANCE_NOT_SUPPORT
GPU instances are not supported for custom image creation.
400
OPERATION_DENIED_INSTANCE_IN_OPERATION
Instance is performing another operation.
400
OPERATION_DENIED_INSTANCE_STATUS_NOT_SUPPORT
Instance state does not allow this operation.
Last updated