CreateImage

1. API Description

This API is used to create a custom image.

Note

  • Up to 5 images can be created in each zone. If you need more, please contact Zenlayer Support.

  • The system disk of an instance will be mirrored while creating an image. Please ensure the instance is shut down. Any operations on the instances are not allowed while creating.

  • The image size is the same as that of instance system disk.

  • Images are not supported in SIN-E and LAX-A for now.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

instanceId

Yes

String

ID of instance to be mirrored.

imageName

Yes

String

Image name to be displayed.

This parameter must contain up to 24 characters. Only Chinese characters, letters, numbers, - and _ are supported.

imageDescription

No

String

Image description. This parameter must contain up to 255 characters.

3. Output Parameters

Parameter NameTypeDescription

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

imageId

String

Image ID.

4. Code Example

Create an image.

POST /api/v2/vm HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateImage
<Common Request Params>

Request:
{
  "instanceId": "your-instance-id",
  "imageName": "testimagename",
  "imageDescription": "testimagedescription"
}

Response:
{
  "requestId": "T69E37B61-4E39-4461-A2BB-205F847D1D60",
  "response": {
    "requestId": "T69E37B61-4E39-4461-A2BB-205F847D1D60",
    "imageId": "img-xxxxx"
  }
}

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.​

HTTP Status CodeError CodeDescription

404

INVALID_INSTANCE_NOT_FOUND

Instance does not exist.

400

UNSUPPORTED_OPERATION_INSTANCE_STATE_STARTING

Shut down the instance before creating an image.

400

LIMIT_EXCEEDED_IMAGE_QUOTA

Quantity of images exceeds the upper limit.

400

UNSUPPORTED_OPERATION_ZONE_NOT_SUPPORT

Operations not supported in current zone.

400

UNSUPPORTED_OPERATION_DISK_UNAVAILABLE

Operations on the image with current status are not supported.

400

UNSUPPORTED_OPERATION_DISK_MAKING_IMAGE

System disk of the instance is being mirrored.

Last updated