Call ImportImage to import your image file to the cloud server.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| ens:ImportImage | create | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| ImageName | string | Yes | Image name. The length should be [2, 128] English or Chinese characters. It must start with a letter (uppercase or lowercase) or a Chinese character, and cannot start with http:// or https://. It can contain numbers, colons (:), underscores (_), or hyphens (-). | 镜像名称 |
| ComputeType | string | Yes |
| ens_vm |
| OSSRegion | string | No | The Region where the image is located. Currently, only cn-beijing is supported. | cn-beijing |
| OSSBucket | string | No | The OSS Bucket where the image file is located. | tmp-hybrid |
| OSSObject | string | No | The name of the image file. | image-test |
| OSType | string | Yes | Operating system platform type. Allowed values:
Currently, only linux is supported. | linux |
| Platform | string | No | Operating system distribution. Allowed values:
| centos |
| ImageFormat | string | Yes | Image format. Allowed values: | qcow2 |
| Architecture | string | Yes | System architecture. Allowed values:
Currently, only x86_64 is supported. | x86_64 |
| OSVersion | string | No | Operating system distribution version | 6.8 |
| DiskDeviceMapping | array<object> | No | List of custom image information being created. | |
| object | No | List of custom image information being created. | ||
| OSSRegion | string | No | The Region where the image is located. | cn-beijing |
| OSSBucket | string | No | The OSS Bucket where the image is stored. | www-cn |
| OSSObject | string | No | The filename (key) of the image file after it is uploaded to the OSS Bucket. | image-bucket |
| TargetOSSRegionId | string | No | The target OSS region where the image will be stored. Note
Currently, only cn-beijing and ap-southeast-1 are supported.
| cn-beijing |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
"ImageId": "m-5wn1dh*******b48f440ntvad"
}Error codes
| HTTP status code | Error code | Error message |
|---|---|---|
| 400 | NoPermission | Permission denied. |
| 400 | InvalidParameter.%s | The specified field %s invalid. Please check it again. |
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2026-01-08 | The Error code has changed | View Change Details |
| 2025-11-03 | The Error code has changed | View Change Details |
