匯出一份自訂映像到與自訂映像同一地域的 OSS Bucket 裡。
介面說明
匯出映像前:
-
您需要先了解前提條件以及注意事項。更多資訊,請參見匯出映像。
-
設定參數
ImageFormat映像匯出格式功能僅在部分地域可用,支援的地域有日本(東京)、印尼(雅加達)、德國(法蘭克福)、阿聯酋(杜拜)、美國(維吉尼亞)、英國(倫敦)、新加坡、馬來西亞(吉隆坡)和美國(矽谷)。不支援設定映像格式的地域,預設匯出 RAW 格式的映像。 -
您必須透過 RAM 授權雲端伺服器 ECS 寫入 OSS 的權限。具體操作說明如下:
建立角色:
AliyunECSImageExportDefaultRole(其他任何角色名稱無效),為該角色設定以下角色原則:{ "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": [ "ecs.aliyuncs.com" ] } } ], "Version": "1" }在角色
AliyunECSImageExportDefaultRole下加入預設的系統權限原則:AliyunECSImageExportRolePolicy,該原則是雲端伺服器 ECS 提供匯出映像的預設原則。更多詳情,請參見雲端資源存取授權。您也可以建立自訂原則,權限需要包含:{ "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 |
否 |
是否只預檢請求。true 表示僅檢查請求,不匯出映像;false 表示匯出映像。 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
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. | 映像名稱不合法。限制條件請參閱 DestinationImageName 參數說明。 |
| 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 | 磁碟大小和磁碟數量不能超過匯出映像的使用限制。 |
| 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. | 不支援將映像匯出到儲存類型為歸檔儲存、冷歸檔儲存或深度冷歸檔儲存的 OSS Bucket 中。 |
| 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. | 指定的映像正在匯出。 |
| 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 是否正確。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。