匯出一份自訂鏡像到與自訂鏡像同一地區的OSS Bucket裡。
介面說明
匯出鏡像前:
-
您需要先瞭解前提條件以及注意事項。更多資訊,請參見匯出鏡像。
-
設定參數
ImageFormat鏡像匯出格式功能僅在部分地區可用,支援的地區有日本(東京)、印尼(雅加達)、德國(法蘭克福)、阿聯酋(杜拜)、美國(維吉尼亞)、英國(倫敦)、新加坡、馬來西亞(吉隆坡)和美國(矽谷)。不支援設定鏡像格式的地區,預設匯出 RAW 格式的鏡像。 -
您必須通過 RAM 授權Elastic Compute Service 寫入 OSS 的許可權。具體操作說明如下:
建立角色:
AliyunECSImageExportDefaultRole(其他任何角色名稱無效),為該角色設定以下角色策略:{ "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": [ "ecs.aliyuncs.com" ] } } ], "Version": "1" }在角色
AliyunECSImageExportDefaultRole下加入預設的系統權限原則:AliyunECSImageExportRolePolicy,該策略是Elastic Compute Service 提供匯出鏡像的預設策略。更多詳情,請參見雲資源訪問授權。您也可以建立自訂策略,許可權需要包含:{ "Version": "1", "Statement": [ { "Action": [ "oss:GetObject", "oss:PutObject", "oss:DeleteObject", "oss:GetBucketLocation", "oss:GetBucketInfo", "oss:AbortMultipartUpload", "oss:ListMultipartUploads", "oss:ListParts" ], "Resource": "*", "Effect": "Allow" } ] }
匯出鏡像後:
自訂鏡像將儲存在指定的 OSS bucket 中,您可以下載自訂鏡像。具體操作,請參見下載自訂鏡像檔案。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:ExportImage |
update |
*Image
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
自訂鏡像的地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。 |
cn-hangzhou |
| ImageId |
string |
是 |
自訂鏡像 ID。 |
m-bp67acfmxazb4p**** |
| OSSBucket |
string |
是 |
儲存匯出鏡像的 OSS bucket。 |
testexportImage |
| OSSPrefix |
string |
否 |
您的 OSS Object 的首碼。可以由數字或者字母組成,字元長度為 1~30。 |
EcsExport |
| ImageFormat |
string |
否 |
鏡像檔案的匯出格式。取值範圍:
預設值:raw。 |
raw |
| RoleName |
string |
否 |
匯出鏡像時使用的 RAM 角色名稱。 |
AliyunECSImageExportDefaultRole |
| DryRun |
boolean |
否 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| RequestId |
string |
請求 ID。 |
C8B26B44-0189-443E-9816-D951F596**** |
| TaskId |
string |
匯出鏡像任務 ID。 |
tsk-bp67acfmxazb4p**** |
| RegionId |
string |
地區 ID。 |
cn-hangzhou |
樣本
正常返回樣本
JSON格式
{
"RequestId": "C8B26B44-0189-443E-9816-D951F596****",
"TaskId": "tsk-bp67acfmxazb4p****",
"RegionId": "cn-hangzhou"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 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個字元。必須以大小字母或中文開頭,不能以aliyun和acs:開頭,不能包含http://或者https://。可以包含數字、半形句號(.)、半形冒號(:)、底線(_)或者短劃線(-)。 |
| 400 | InvalidOSSPrefix.Malformed | The specified OSSPrefix format is wrongly formed. | 參數 OssPrefix 格式錯誤。 |
| 400 | InvalidRegionId.NotFound | The specified RegionId does not exist. | |
| 400 | InvalidRegion.NotSupport | The specified region does not support image import or export. | 指定的地區暫時不支援此操作。 |
| 400 | IncorrectImageStatus | The specified Image is not available. | 指定的源鏡像狀態不正確。 |
| 400 | InvalidImageFormat.Malformed | The specified Image Format is wrongly formed. | 指定的鏡像格式錯誤。 |
| 400 | InvalidOSSBucket.NotFound | The specified OSS bucket does not exist in this region. | 指定的 bucket 不存在。 |
| 400 | OperationDenied | The specified image contains the snapshot of the data disk,does not support this operation. | 包含了資料盤快照的鏡像,不支援此操作。 |
| 400 | InvalidImage.DiskAmountOrSize | %s | 無效的鏡像,匯出的鏡像限制資料盤數不能超過 4 塊,單塊資料盤容量最大不能超過 500 GiB。 |
| 400 | ImageNotSupported | The specified Image contains encrypted snapshots, do not support export. | 指定的鏡像包含了加密快照,不支援匯出。 |
| 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 | InvalidImageFormat.RegionNotSupported | The specified image format is not supported in current region. | |
| 400 | InvalidOSSBucket.ArchiveOssBucketNotSupported | Exporting an image to an OSS bucket with Archive, Cold Archive, or Deep Cold Archive storage class is not supported. | 不支援將鏡像匯出到儲存類型為Archive Storage、冷Archive Storage或深度冷Archive Storage的OSSBucket中。 |
| 403 | ImageNotSupported | The specified image from the image market, do not support export image. | 指定的鏡像來自雲市場鏡像,此鏡像不能匯出。 |
| 403 | ImageIsExporting | The specified Image is being exported. You can use the DescribeTasks API to check the status of existing tasks. | 指定的鏡像正在被匯出。您可以使用DescribeTasks API查詢進行中的任務狀態。 |
| 403 | ExportImageFailed | Exporting image is failed, Please contact the administrator. | 匯出鏡像失敗,請聯絡系統管理員。 |
| 403 | UserNotInTheWhiteList | The user is not in the white list of exporting 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 | InvalidOSS.NotAuthorized | The specified OSS bucket or object is not allowed to access. | 您沒有許可權訪問指定的OSS的bucket和Object。 |
| 403 | ConcurrentQuotaExceed.ExportImage | %s | |
| 403 | WeeklyQuotaExceed.ExportImage | %s | |
| 403 | InvalidImageLicense.NotSupported | %s | 指定的鏡像不支援匯出。具體資訊請參見錯誤資訊%s預留位置的實際傳回值。 |
| 403 | InvalidImageCategory.NotSupported | The specified image category is not supported. | 指定鏡像的鏡像所屬類型(ImageCategory或更通用稱為ImageOwnerAlias)不支援此操作。 |
| 403 | InvalidOSSBucket.EncryptUnsupported | Accessing objects from encrypted OSS bucket is not supported. | 不支援從加密的OSS bucket讀取對象。 |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的鏡像在該使用者帳號下不存在,請您檢查鏡像 ID 是否正確。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。