Exporta una imagen personalizada a un bucket de OSS en la misma región que la imagen.
Descripción de la operación
Antes de exportar una imagen:
-
Revise los requisitos previos y las consideraciones en Exportar una imagen.
-
El parámetro
ImageFormatsolo está disponible en las siguientes regiones: Japón (Tokio), Indonesia (Yakarta), Alemania (Fráncfort), EAU (Dubái), EE. UU. (Virginia), Reino Unido (Londres), Singapur, Malasia (Kuala Lumpur) y EE. UU. (Silicon Valley). En las regiones que no admiten este parámetro, las imágenes se exportan en formato RAW de forma predeterminada. -
Debe usar RAM para otorgar permisos a ECS con el fin de escribir en OSS. Siga estos pasos:
Cree un rol con el nombre requerido
AliyunECSImageExportDefaultRoley adjunte la siguiente política de confianza:``` { "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": [ "ecs.aliyuncs.com" ] } } ], "Version": "1" }Adjunte la política de permisos del sistema predeterminada,
AliyunECSImageExportRolePolicy, al rolAliyunECSImageExportDefaultRole. Para obtener más detalles, consulte Otorgar permisos a un rol de RAM. También puede crear una política personalizada que incluya los siguientes permisos:``` { "Version": "1", "Statement": [ { "Action": [ "oss:GetObject", "oss:PutObject", "oss:DeleteObject", "oss:GetBucketLocation", "oss:GetBucketInfo", "oss:AbortMultipartUpload", "oss:ListMultipartUploads", "oss:ListParts" ], "Resource": "*", "Effect": "Allow" } ] }
Después de exportar la imagen:
La imagen personalizada se almacena en el bucket de OSS especificado. Para obtener instrucciones de descarga, consulte Descargar una imagen personalizada.
Pruébelo ahora
Test
Autorización de RAM
|
Action |
Nivel de acceso |
Tipo de recurso |
Clave de condición |
Acción dependiente |
|
ecs:ExportImage |
update |
*Image
|
Ninguna | Ninguna |
Parámetros de la solicitud
|
Parámetro |
Tipo |
Obligatorio |
Descripción |
Ejemplo |
| RegionId |
string |
Sí |
El ID de la región de la imagen personalizada. Puede llamar a DescribeRegions para ver la lista más reciente de regiones de Alibaba Cloud. |
cn-hangzhou |
| ImageId |
string |
Sí |
El ID de la imagen personalizada. |
m-bp67acfmxazb4p**** |
| OSSBucket |
string |
Sí |
El bucket de OSS de destino para la imagen exportada. |
testexportImage |
| OSSPrefix |
string |
No |
El prefijo del objeto de OSS. El prefijo debe tener entre 1 y 30 caracteres de longitud y puede contener letras y dígitos. |
EcsExport |
| ImageFormat |
string |
No |
El formato del archivo de imagen exportado. Valores válidos:
Valor predeterminado: raw. |
raw |
| RoleName |
string |
No |
El nombre del rol de RAM utilizado para exportar la imagen. |
AliyunECSImageExportDefaultRole |
| DryRun |
boolean |
No |
Especifica si se debe realizar una ejecución de prueba para verificar la validez de la solicitud sin exportar realmente la imagen. Valores válidos:
Valor predeterminado: false. |
Elementos de la respuesta
|
Elemento |
Tipo |
Descripción |
Ejemplo |
|
object |
|||
| RequestId |
string |
El ID de la solicitud. |
C8B26B44-0189-443E-9816-D951F596**** |
| TaskId |
string |
El ID de la tarea de exportación de la imagen. |
tsk-bp67acfmxazb4p**** |
| RegionId |
string |
El ID de la región. |
cn-hangzhou |
Ejemplos
Respuesta exitosa
JSON Formato
{
"RequestId": "C8B26B44-0189-443E-9816-D951F596****",
"TaskId": "tsk-bp67acfmxazb4p****",
"RegionId": "cn-hangzhou"
}
Códigos de error
|
Código de estado HTTP |
Código de error |
Mensaje de error |
Descripción |
|---|---|---|---|
| 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. | The specified image name is invalid. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with acs: or aliyun. It can contain letters, digits, periods (.), colons (:), underscores (_), and hyphens (-). It cannot contain http:// or https://. |
| 400 | InvalidOSSPrefix.Malformed | The specified OSSPrefix format is wrongly formed. | The specified OssPrefix parameter is invalid. |
| 400 | InvalidRegionId.NotFound | The specified RegionId does not exist. | |
| 400 | InvalidRegion.NotSupport | The specified region does not support image import or export. | The specified region does not support the operation. |
| 400 | IncorrectImageStatus | The specified Image is not available. | The specified image is an Alibaba Cloud Marketplace image. The sale of this image has ended. Contact the image service provider for more information. |
| 400 | InvalidImageFormat.Malformed | The specified Image Format is wrongly formed. | The specified image format is invalid. |
| 400 | InvalidOSSBucket.NotFound | The specified OSS bucket does not exist in this region. | The specified bucket does not exist. |
| 400 | OperationDenied | The specified image contains the snapshot of the data disk,does not support this operation. | Images that contain data disk snapshots do not support this operation. |
| 400 | InvalidImage.DiskAmountOrSize | %s | The image cannot be exported because it contains more than four data disk snapshots or because one of its data disk snapshot exceeds 500 GiB in size. |
| 400 | ImageNotSupported | The specified Image contains encrypted snapshots, do not support export. | The specified image contains encrypted snapshots and cannot be exported. |
| 400 | InvalidOSSObject.NeedRestore | The specified OSS object is a archive object, need restore first. | |
| 400 | InvalidOSSBucket.NotMatched | The specified OSS bucket is incorrect, %s. | The specified DiskDeviceMapping.N.OSSBucket parameter is invalid. For more information, see the return value of the %s placeholder in the error message. |
| 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. | Exporting an image to an OSS bucket with Archive, Cold Archive, or Deep Cold Archive storage class is not supported. |
| 403 | ImageNotSupported | The specified image from the image market, do not support export image. | The specified image is an Alibaba Cloud Marketplace image and cannot be exported. |
| 403 | ImageIsExporting | The specified Image is being exported. You can use the DescribeTasks API to check the status of existing tasks. | The specified image is being exported. You can use the DescribeTasks API to query the status of tasks in progress. |
| 403 | ExportImageFailed | Exporting image is failed, Please contact the administrator. | The image cannot be exported. Contact your system administrator. |
| 403 | UserNotInTheWhiteList | The user is not in the white list of exporting image. | You are not authorized to export images. |
| 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. | You do not have the permission to access the specified OSS bucket and object. |
| 403 | ConcurrentQuotaExceed.ExportImage | %s | |
| 403 | WeeklyQuotaExceed.ExportImage | %s | |
| 403 | InvalidImageLicense.NotSupported | %s | The specified image does not support export. For more information, see the actual value returned in the %s placeholder of the error message. |
| 403 | InvalidImageCategory.NotSupported | The specified image category is not supported. | The type of mirror to which the specified mirror belongs (ImageCategory or more commonly known as ImageOwnerAlias) does not support this operation. |
| 403 | InvalidOSSBucket.EncryptUnsupported | Accessing objects from encrypted OSS bucket is not supported. | You cannot read objects from encrypted OSS buckets. |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | The specified image does not exist in this account. Check whether the image ID is correct. |
Consulte Códigos de error para ver la lista completa.
Notas de la versión
Consulte Notas de la versión para ver la lista completa.