Creates a custom image from a simple application server.

Description

A custom image is created from a snapshot of a simple application server. You can use custom images to create multiple simple application servers that have the same configurations. You can also share custom images with Elastic Compute Service (ECS) and use the shared images to create ECS instances or replace the OS of existing ECS instances.

For more information about custom images, see Overview of custom images.

You must create a system disk snapshot of a simple application server before you create a custom image of the simple application server. For more information, see CreateSnapshot.

Note If you need the data on the data disks of a simple application server when you create a custom image of the simple application server, create snapshots for the data disks first.

When you create a custom image, take note of the following items:

  • The region of the custom image is the same as the region of the corresponding simple application server.
  • The maximum number of custom images that can be created is three times the number of simple application servers that you have, but cannot exceed 15.
  • You can directly create a custom image only from the system disk snapshot of a simple application server. If you want a custom image to contain the data on the data disks of the simple application server, you must manually select the corresponding data disk snapshots when you create the custom image.

QPS limits

The queries per second (QPS) limit for a single user for the API operation is 10 calls per minute. If the number of calls to the API operation per minute exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limit.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateCustomImage

The operation that you want to perform. Set the value to CreateCustomImage.

RegionId String Yes cn-hangzhou

The region ID of the simple application server. You can call the ListRegions operation to query the most recent region list.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

InstanceId String Yes ace0706b2ac4454d984295a94213****

The ID of the simple application server.

ImageName String Yes customImage-test

The name of the custom image. This parameter is empty by default. If this parameter is specified, the name must be 2 to 128 characters in length, and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter or a digit.

SystemSnapshotId String Yes s-acscasca****

The ID of the system disk snapshot.

Description String No test

The description of the custom image.

DataSnapshotId String No s-acscasca****

The ID of the data disk snapshot.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

ImageId String m-csaascsaccscs****

The ID of the custom image.

Examples

Sample requests

https://swas.cn-hangzhou.aliyuncs.com/?Action=CreateCustomImage
&ImageName=customImage-test
&InstanceId=ace0706b2ac4454d984295a94213****
&RegionId=cn-hangzhou
&SystemSnapshotId=s-acscasca****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateCustomImageResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
<ImageId>m-csaascsaccscs****</ImageId>
</CreateCustomImageResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "CreateCustomImageResponse" : {
    "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
    "ImageId" : "m-csaascsaccscs****"
  }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParam.DataSnapshotIdNotFound The specified parameter dataSnapshotId is not found. The error message returned because the specified DataSnapshotId parameter is invalid.
400 InvalidParam.SystemSnapshotIdNotFound The specified parameter systemSnapshotId is not found. The error message returned because the specified SystemSnapshotId parameter is invalid.
400 InvalidParam.IllegalImageName The specified parameter imageName is illegal. The error message returned because the specified ImageName parameter is invalid.
400 ImageNameAlreadyExist The image name already exists. The error message returned because the specified image name already exists.
400 CustomImageQuotaLimit The maximum number of custom image in this region is exceeded. The error message returned because the maximum number of custom images allowed for the region is reached.
400 InvalidParam.SystemSnapshotIdNotSupport You cannot create custom images in the specified parameter system snapshotId. The error message returned because the specified SystemSnapshotId parameter cannot be used to create a custom image.
403 IncorrectInstanceStatus The state of the current instance does not support this operation. The error message returned because the operation is not supported while the simple application server is in the current state.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter is invalid.
500 InternalError An error occurred while processing your request. The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket.

For a list of error codes, visit the API Error Center.