全部產品
Search
文件中心

Elastic Compute Service:ImportImage

更新時間:Jul 28, 2026

匯入一份您的本機映像檔案到雲端伺服器 ECS,作為自訂映像出現在相應地域中。後續您可以使用匯入的映像建立 ECS 執行個體(RunInstances),或者更換執行個體的系統磁碟(ReplaceSystemDisk)。

介面說明

介面說明。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ImportImage

update

*Image

acs:ecs:{#regionId}:{#accountId}:image/*

無 無

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

是

來源自訂映像的地域 ID。您可以呼叫 DescribeRegions 檢視最新的阿里雲地域清單。

cn-hangzhou

ImageName

string

否

映像名稱。長度為 2~128 個字元。必須以大小寫字母或中文開頭,不能以 aliyun 或 acs: 開頭,不能包含 http:// 或者 https://。可以包含數字、半形句號(.)、半形冒號(:)、底線(_)或者連字號(-)。

ImageTestName

Description

string

否

映像的描述資訊。長度為 2~256 個英文或中文字元,不能以 http:// 或 https:// 開頭。

TestDescription

Architecture

string

否

系統架構。取值範圍:

x86_64

OSType

string

否

作業系統類型。取值範圍:

linux

Platform

string

否

作業系統版本。取值範圍:

Aliyun

BootMode

string

否

修改映像的啟動模式。取值範圍:

BIOS

RoleName

string

否

匯入映像時,使用的 RAM 角色名稱。

AliyunECSImageImportDefaultRole

LicenseType

string

否

授權類型,預設該映像在建立執行個體( RunInstances )時的授權模式。該值僅對 Windows Server 類型映像生效。取值範圍:

BYOL

ResourceGroupId

string

否

匯入映像所在的企業資源群組 ID。

rg-bp67acfmxazb4p****

DiskDeviceMapping

array<object>

否

建立的自訂映像資訊清單。

object

否

建立的自訂映像資訊清單。

DiskImSize

integer

否

自訂映像大小。單位:GiB。

80

Device

string

否

指定 DiskDeviceMapping.N.Device 在自訂映像中的裝置名稱。

null

OSSBucket

string

否

映像檔案所在的 OSS Bucket。

ecsimageos

Format

string

否

映像格式。取值範圍:

QCOW2

OSSObject

string

否

映像上傳至 OSS Bucket 後,儲存在 Bucket 中的映像檔案的檔案名稱(key)。

CentOS_5.4_32.raw

DiskImageSize

integer

否

匯入映像後,自訂映像的空間大小。

80

Tag

array<object>

否

映像的標籤清單。

object

否

映像的標籤清單。

Key

string

否

映像的標籤鍵。N 的取值範圍:1~20。一旦傳入該值,則不允許為空字串。最多支援 128 個字元,不能以 aliyun 或者 acs: 開頭,不能包含 http:// 或者 https://。

TestKey

Value

string

否

映像的標籤值。N 的取值範圍:1~20。一旦傳入該值,允許為空字串。最多支援 128 個字元,不能以 acs: 開頭,不能包含 http:// 或者 https://。

TestValue

DetectionStrategy

string

否

映像檢測策略,未設定此參數時不觸發檢測。僅支援標準(Standard)檢測模式。

Standard

StorageLocationArn

string

否

指定雲盒的資源名稱(ARN),用於唯一識別雲端儲存位置。

arn:acs:cloudbox:cn-hangzhou:123456:cloudbox/cb-xx***123

DryRun

boolean

否

是否只預檢此次請求。取值範圍:

false

Features

object

否

映像特性相關屬性。

NvmeSupport

string

否

映像是否支援 NVMe。

supported

ImdsSupport

string

否

映像的中繼資料存取模式,可能值:

v2

ClientToken

string

否

保證請求冪等性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證冪等性。

123e4567-e89b-12d3-a456-426655440000

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

ImageId

string

映像 ID。

m-bp67acfmxazb4p****

TaskId

string

匯入映像任務 ID。

t-bp67acfmxazb4p****

RegionId

string

地域 ID。

cn-hangzhou

樣本

正常返回樣本

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "ImageId": "m-bp67acfmxazb4p****",
  "TaskId": "t-bp67acfmxazb4p****",
  "RegionId": "cn-hangzhou"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 UnsupportedSuffix.OSSObject The specified OSS object suffix is not supported. 不支援指定的 OSS 物件後綴。
400 MissingParameter An input parameter "RegionId" that is mandatory for processing the request is not supplied.
400 InvalidImageName.Malformed The specified Image name is wrongly formed. 映像名稱的長度為 2~128 個英文或中文字元。必須以大小寫字母或中文開頭,可以包含數字、半形冒號(:)、底線(_)或者連字號(-)。
400 InvalidOSSObject.Malformed The specified OSS object is wrongly formed. 指定的 OSS Object 不合法。
400 InvalidOSSBucket.Malformed The specified OSS bucket is wrongly formed.
400 InvalidOSSObject.Size The specified OSS object size is zero. 指定的 OSSObject 為空。
400 InvalidDescription.Malformed The specified Image description is wrongly formed. 指定的參數 description 無效。
400 InvalidArchitecture.Malformed The specified Architecture is wrongly formed. 您輸入的參數 Architecture 無效,請檢視該參數格式是否正確。
400 InvalidPlatform.Malformed The specified Platform is wrongly formed. 指定的平台無效。
400 InvalidOSType.Malformed The specified OSType is wrongly formed. 格式不對。
400 InvalidImageName.Duplicated The destination image is exist.
400 InvalidImageSize %s 映像大小不符合要求。
400 InvalidDataDiskSize The specified DiskDeviceMapping.N.DiskImSize should be in the specified range. 指定的 DiskDeviceMapping.N.DiskImSize 超出取值範圍。
400 InvalidImageFormat.Malformed The specified Image Format is wrongly formed. 指定的映像格式錯誤。
400 InvalidRegionId.NotFound The specified RegionId does not exist.
400 InvalidRegion.NotSupport The specified region does not support image import or export. 該地域不支援 BYOK。
400 InvalidOSSBucket.NotFound The specified OSS bucket does not exist in this region. 指定的 Bucket 不存在。
400 InvalidOSSObject.NotFound The specified OSS object does not exist in this region.
400 InvalidOSSObject.NeedRestore The specified OSS object is a archive object, need restore first.
400 InvalidOSSBucket.NotMatched The specified OSS bucket is incorrect, %s. 指定的 OSS Bucket 有誤,具體資訊請參見錯誤訊息的實際返回結果。
400 InvalidLicenseType.NotSupported The specified LicenseType is not supported.
400 InvalidLicenseType.BYOLOnly Only BYOL LicenseType is supported for the current platform provided.
400 InvalidOSSBucket.FlowLimit %s
400 InvalidImageFormat.RegionNotSupported The specified image format is not supported in current region.
400 InvalidBootMode.Malformed The specified parameter "BootMode" is malformed.
400 InvalidParameter.DetectionStrategy The specified parameter DetectionStrategy is invalid.
400 InvalidBootMode.NotSupport The specified parameter BootMode is not supported for current image architecture. 目前的映像架構不支援設定該啟動模式。
400 DRYRUN.SUCCESS This request is a dryrun request with successful result. 該請求是 DryRun 請求(模擬執行),此錯誤代表請求驗證成功。
400 InvalidClientToken.Malformed The specified parameter clientToken is not valid. 指定的參數 ClientToken 格式不符合規範要求,該參數應該只包括 ASCII 字元,且長度不應該超過 64 個字元。
400 InvalidParameter.FeaturesImdsSupport The specified parameter Features.ImdsSupport is not supported. 指定的參數 Features.ImdsSupport 不支援。
400 Account.Arrearage Your account has an outstanding payment. 您的帳號存在未支付的款項。
403 ImageIsImporting The specified Image is importing.
403 QuotaExceed.Image The Image Quota exceeds.
403 ImportImageFailed Importing image is failed, Please contact the administrator. 匯入映像失敗,請聯絡系統管理員排查。
403 UserNotInTheWhiteList The user is not in the white list of importing image.
403 NoSetRoletoECSServiceAcount ECS service account Have no right to access your OSS.please attach a role of access your oss to ECS service account.
403 InvalidParameter.Malformed The specified parameter "DiskDeviceMapping.n.Device " is not valid.
403 MissingParameter.DiskDeviceMapping The specified parameter DiskDeviceMapping is not supplied. 參數 DiskDeviceMapping 不能為空。
403 InvalidOSS.NotAuthorized The specified OSS bucket or object is not allowed to access. 您沒有權限存取指定的 OSS Bucket 和 Object。
403 InvalidBlockSize.NotSupport %s 不支援映像檔的分割區大小。
403 InvalidImageFormat.Malformed %s
403 ImageCheckUnsupported.WindowsImage Image check is unsupported for windows image.
403 InvalidVHDImage.IncorrectSize The specified size of the VHD image does not meet the 'header.MaxTableEntries * header.BlockSize' specification. 指定的 VHD 映像大小不符合 'header.MaxTableEntries * header.BlockSize' 的規範。
403 InvalidOSSBucket.EncryptUnsupported Accessing objects from encrypted OSS bucket is not supported. 不支援從加密的 OSS Bucket 讀取物件。
403 InvalidArchitecture.PlatformUnsupported The OS platform you selected does not support the specified architecture. 您選擇的作業系統平台不支援指定的架構類型。
403 InvalidAccountStatus.OSSDisabled OSS is disabled due to invalid account status. 由於帳戶狀態無效,OSS 已停用。
403 InvalidStorageLocation.NotFound The specified cloud box storage location %s could not be found. 找不到指定的雲端盒子儲存位置。
403 InvalidOperation.CloudBoxImageImportRoleRequired The role for cloud box image import is not set to the ECS service. 未設定用於雲端運算盒映像匯入的角色給 ECS 服務。
403 InvalidOperation.CloudBoxImageImportUnsupported Importing cloud box images is not supported. 不支援匯入雲端運算盒映像。
403 TagKey.Duplication The TagKey has duplication with others, case-insensitive. 指定的 Tag.N.Key 參數中存在重複的取值。該參數的取值不區分大小寫,請檢查是否傳入了重複的參數值。
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. 找不到對應的資源群組。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。