複製一個地區下的自訂鏡像到其他地區。複製鏡像可以實現跨地區部署ECS執行個體、跨地區複製ECS執行個體等目的。
介面說明
介面說明
您可以在其他地區使用複製後的鏡像建立 ECS 執行個體(RunInstances),或者更換執行個體的系統硬碟(ReplaceSystemDisk)。
調用該介面時,您需要注意:
自訂鏡像的狀態必須為可用(
Available)。鏡像是您帳號下的自訂鏡像時,可以跨地區複製鏡像;鏡像是其他人共用給您的鏡像時,只能同地區複製鏡像。
複製鏡像期間,您無法直接操作刪除( DeleteImage )複製中的鏡像,但是您可以通過取消複製任務( CancelCopyImage )的方式來刪除複製中的鏡像。
同一個地區下同時只能有五個鏡像複製任務運行,其餘任務需要排隊等待上述任一任務完成後再依次排隊執行。
您可以通過
ResourceGroupId參數指定複製後的鏡像所屬的資源群組。如果不設定ResourceGroupId參數值,複製後的鏡像屬於預設資源群組。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:CopyImage |
update |
*Image
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| DestinationImageName |
string |
否 |
複製後的鏡像的名稱。長度為 2~128 個字元。必須以大小寫字母或中文開頭,也不能以 |
YourImageName |
| DestinationDescription |
string |
否 |
複製後的鏡像的描述資訊。長度為 2~256 個英文或中文字元,不能以 |
This is a description example. |
| ImageId |
string |
是 |
源自訂鏡像的 ID。 |
m-bp1h46wfpjsjastc**** |
| RegionId |
string |
是 |
源自訂鏡像的地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。 |
cn-hangzhou |
| DestinationRegionId |
string |
否 |
複製到目標地區的 ID。 |
cn-shanghai |
| Encrypted |
boolean |
否 |
是否加密複製後的鏡像。
預設值:不指定。 |
false |
| KMSKeyId |
string |
否 |
加密鏡像使用的金鑰識別碼。 |
e522b26d-abf6-4e0d-b5da-04b7******3c |
| EncryptAlgorithm |
string |
否 |
說明
該參數暫未開放使用。 |
hide |
| ResourceGroupId |
string |
否 |
複製後的鏡像的資源群組 ID。如果不設定該參數值,複製後的鏡像屬於預設資源群組。 說明
如果您當前使用的是 RAM 使用者調用該介面,且 |
rg-bp67acfmxazb4p**** |
| Tag |
array<object> |
否 |
標籤列表。 |
|
|
object |
否 |
標籤列表。 |
||
| Value |
string |
否 |
複製後的鏡像的標籤值。N 的取值範圍為 1~20。一旦傳入該值,可以為空白字串。最多支援 128 個字元,不能以 |
TestValue |
| Key |
string |
否 |
複製後的鏡像的標籤鍵。N 的取值範圍為 1~20。一旦傳入該值,則不允許為空白字串。最多支援 128 個字元,不能以 |
TestKey |
| DryRun |
boolean |
否 |
是否只預檢此次請求。取值範圍:
預設值:false。 |
false |
| ClientToken |
string |
否 |
保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證等冪性。 |
123e4567-e89b-12d3-a456-426655440000 |
| 情境 | 源鏡像狀態 | Encrypted 參數 | KMSKeyId 參數 | 目標地區是否配置Block Storage帳號級加密 | 目標鏡像結果 | 結果說明 |
| 1 | 非加密鏡像 | False 或未指定 | 未指定 | 未配置 | 非加密鏡像 | 不加密,鏡像保持原樣。 |
| 2 | 非加密鏡像 | True | 未指定 | 任意 | 全加密鏡像 | 使用者顯式要求加密。如果已經配置了Block Storage帳號級加密,則選擇配置的預設祕密金鑰加密。否則使用服務祕密金鑰加密。 |
| 3 | 非加密鏡像 | True | 指定 | 任意 | 全加密鏡像 | 使用者顯式要求加密。使用使用者指定的 KMSKeyId 加密。 |
| 4 | 非加密鏡像 | 未指定 | 未指定 | 已配置 | 全加密鏡像 | 使用Block Storage帳號級加密配置的祕密金鑰加密。 |
| 5 | 加密鏡像 | 未指定 | 未指定 | 未配置 | 加密鏡像 | 保持原有的格式,不加密的快照不加密,加密的按照服務祕密金鑰加密。 |
| 6 | 加密鏡像 | 未指定或 True | 未指定 | 已配置 | 全加密鏡像 | 使用Block Storage帳號級加密配置的祕密金鑰加密。 |
| 7 | 加密鏡像 | True | 未指定 | 未配置 | 全加密鏡像 | 使用服務祕密金鑰加密。 |
| 8 | 加密鏡像 | True | 未指定 | 已配置 | 全加密鏡像 | 使用Block Storage帳號級加密配置的祕密金鑰加密。 |
| 9 | 加密鏡像 | True | 指定 | 任意 | 全加密鏡像 | 使用者顯式要求加密。使用使用者指定的 KMSKeyId 加密。 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| ImageId |
string |
複製後的鏡像的 ID。 |
m-bp1h46wfpjsjastd**** |
| RequestId |
string |
請求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
樣本
正常返回樣本
JSON格式
{
"ImageId": "m-bp1h46wfpjsjastd****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
異常返回樣本
JSON格式
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"ImageId": "Img-231234567"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | InvalidDescription.Malformed | The specified destination description is wrongly formed. | 指定的資源描述格式不合法。長度為 2-256 個字元,不能以 http:// 和 https:// 開頭。 |
| 400 | SourceRegion.NotFound | The source region not found. | |
| 400 | DestinationRegion.NotFound | The destination region not found. | 未找到目的地區 |
| 400 | IncorrectImageStatus | The image not available. | 指定的鏡像不可用。 |
| 400 | InvalidSnapshotId.NotFound | The specified SnapshotId does not exist. | 指定的快照不存在,請您檢查快照是否正確。 |
| 400 | InvalidImageName.Duplicated | The specified image name is already in use in the target region. Please try a different one. | 指定的鏡像名稱已在目標地區使用。請嘗試另一個。 |
| 400 | InvalidParameter.EncryptedIllegal | The specified parameter Encrypted must be true when kmsKeyId is not empty. | 設定參數 KMSKeyId 後,您必須開啟加密屬性。 |
| 400 | InvalidEncrypted.NotMatchEncryptAlgorithm | The specified parameter Encrypted must be true when EncryptAlgorithm is not empty. | |
| 400 | InvalidEncryptAlgorithm | The specified parameter EncryptAlgorithm is not valid. | |
| 400 | InvalidEncrypted.NotMatchKmsKeyId | The specified parameter Encrypted must be true when KmsKeyId is not empty. | |
| 400 | OperationDenied.CommunityImage | Community image does not support copy. | 社區鏡像不支援複製。 |
| 400 | InvalidImageName.Malformed | The specified destination image name is wrongly formed. | 鏡像名稱不合法。限制條件請參見 DestinationImageName 參數說明。 |
| 400 | InvalidParameter.KmsNotEnabled | The specified operation need enable KMS. | 當前操作需要開啟KMS。 |
| 400 | OperationDenied.ImageCopyConflict | The same image cannot be copied concurrently. Please wait until the last copy is completed before performing the next operation. | 同一鏡像不能並發拷貝,請等待上一次拷貝完成再進行下一次操作。 |
| 400 | Account.Arrearage | Your account has an outstanding payment. | 您的帳號存在未支付的款項。 |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | 標籤中存在重複的鍵,請保持鍵的唯一性。 |
| 401 | InvalidAliUid.IsNull | The aliUid must not be null. | |
| 500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | 內部錯誤,請重試。 |
| 403 | Forbbiden | User not authorized to operate on the specified resource. | 使用者未被授權操作指定的資源。 |
| 403 | InvalidOperation.CopyingDataFromThisRegionUnsupported | Data transfer from the current region to other regions is not supported. | 不支援從當前地區複製資料到其他地區。 |
| 403 | InvalidOperation.CopyingDataToThisRegionUnsupported | Only Some Regions %s can copy data to this region. | 只有某些地區可以複製資料到當前地區。 |
| 403 | QuotaExceed.Image | The number of images exceeds the limit (%s). | 鏡像數量超過限制。 |
| 403 | QuotaExceed.Snapshot | The snapshot quota exceeds. | |
| 403 | OperationDenied.ImageCopying | The image is currently being copied. Please try again later. | 鏡像正在被複製,請稍後重試。 |
| 403 | RegionNotSupportCopy | The region not support copy. | |
| 403 | InvalidSnapshot.TooOld | This operation is denied because the specified snapshot is created before 2013-07-15. | 該操作被拒絕。因為指定的快照建立於 2013-07-15 之前。 |
| 403 | OperationDenied | The specified snapshot is not allowed to create image. | 指定快照不允許建立鏡像。 |
| 403 | IncorrectDestinationRegion | The destination region is not equal the target region. | |
| 403 | OperationDeined.EncryptedSnapshot | The image contains encrypted snapshots, which do not support copying. | 指定的鏡像含有加密快照,不支援複製這種鏡像。 |
| 403 | OperationDenied.SameRegionOnly | The image shared from others can not be copied to another region directly. | 其他人分享的鏡像不能複製到另一個地區。 |
| 403 | OperationDenied.NotPublished | The operation is denied because corresponding marketplace image is not published in destination region. | 指定的操作無法執行,鏡像的原始鏡像來自雲市場,並且未在目標地區發布。 |
| 403 | OperationDenied.NotAuthorized | The operation is denied because corresponding marketplace image is not authorized to current user. | |
| 403 | OperationDenied.EncryptSnapshotAcrossRegion | The image do not contain encrypted snapshots, which do not support copying to encrypted ones. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service have no right to access your KMS. | ECS 服務無權訪問您的 KMS。 |
| 403 | InvalidRegion.NotSupport | The specified region does not support byok. | 該地區不支援BYOK。 |
| 403 | UserNotInTheWhiteList | The user is not in byok white list. | 您不在byok白名單中,請加入白名單後重試。 |
| 403 | InvalidRegionId.NotSupportEncryptAlgorithm | The current region does not support creating encrypted disks with EncryptAlgorithm. | |
| 403 | OperationDenied.KmsServiceUnauthorized | The account is not authorized to kms service, please authorize it. | 使用者未授權kms服務,請先授權。 |
| 403 | OperationDenied.NonCompliantDestinationRegion | The copy operation to the destination region is not in compliance with regulations. | 目標地區不符合安全合規要求。 |
| 403 | InvalidEncrypted.NotMatchDiskDefaultEncryption | The specified parameter Encrypted not match for your account default encryption settings. | 加密參數不匹配當前帳號雲端硬碟預設加密配置。 |
| 403 | InvalidParameter.DataEncryptedKeyCreateFailed | Create kms data encrypted key fail. If you need further assistance, you can contact the KMS Technical Support. | 使用KMS主要金鑰建立資料密鑰失敗,請聯絡KMS值班同學進一步排查。 |
| 403 | SizeExceed.Image | The image exceeds the maximum size. You can use the CopySnapshot API to copy your snapshots of the image and then create a new image from them. | 鏡像的大小已超過可操作的最大值。您可以使用CopySnapshot介面複製這個鏡像的快照到目標地區,然後用複製後快照建立一個新的鏡像。 |
| 403 | InvalidParameter.KMSKeyId.CMKNotEnabled | The CMK (Customer Master Key) must be in an active state. | 使用者主要金鑰(CMK)需要處於活動狀態。 |
| 403 | InvalidParameter.KMSKeyId.CMKUnauthorized | The CMK(Customer Master Key) lacks authorization to add tags to the ECS service. | 使用者主要金鑰(CMK)未授權ECS服務添加標籤許可權。 |
| 403 | InvalidOperation.VhdImageUnsupported | The specified vhd image is not supported for this operation. Please switch to a raw image and retry. | vhd格式鏡像不支援該操作,請切換使用raw格式鏡像後重試。 |
| 403 | InvalidOperation.CloudBoxImageCopyUnsupported | Copying CloudBox images is not supported. | 雲盒鏡像不支援複製。 |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的鏡像在該使用者帳號下不存在,請您檢查鏡像 ID 是否正確。 |
| 404 | InvalidParameter.KMSKeyId.NotFound | The specified KMSKeyId does not exist. | 指定的參數 KMSKeyId 不存在。 |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | 資源群組並不在記錄中。 |
| 409 | InvalidOperation.Conflict | Request was denied due to conflict with a previous request, please try again later. | 請求操作的資源與之前的請求衝突 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。