Exporta uma imagem personalizada para um bucket do OSS na mesma região da imagem.
Descrição da operação
Antes de exportar uma imagem:
-
Revise os pré-requisitos e considerações em Exportar uma imagem.
-
O parâmetro
ImageFormatestá disponível apenas nas seguintes regiões: Japão (Tóquio), Indonésia (Jacarta), Alemanha (Frankfurt), Emirados Árabes Unidos (Dubai), EUA (Virgínia), Reino Unido (Londres), Singapura, Malásia (Kuala Lumpur) e EUA (Vale do Silício). Nas regiões que não suportam este parâmetro, as imagens são exportadas no formato RAW por padrão. -
Você deve usar o RAM para conceder permissões ao ECS para gravar no OSS. Siga estas etapas:
Crie uma função com o nome obrigatório
AliyunECSImageExportDefaultRolee anexe a seguinte política de confiança:``` { "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": [ "ecs.aliyuncs.com" ] } } ], "Version": "1" }Anexe a política de permissão padrão do sistema,
AliyunECSImageExportRolePolicy, à funçãoAliyunECSImageExportDefaultRole. Para mais detalhes, consulte Conceder permissões a uma função do RAM. Você também pode criar uma política personalizada que inclua as seguintes permissões:``` { "Version": "1", "Statement": [ { "Action": [ "oss:GetObject", "oss:PutObject", "oss:DeleteObject", "oss:GetBucketLocation", "oss:GetBucketInfo", "oss:AbortMultipartUpload", "oss:ListMultipartUploads", "oss:ListParts" ], "Resource": "*", "Effect": "Allow" } ] }
Após a exportação da imagem:
A imagem personalizada é armazenada no bucket do OSS especificado. Para obter instruções de download, consulte Baixar uma imagem personalizada.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
ecs:ExportImage |
update |
*Image
|
Nenhuma | Nenhuma |
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| RegionId |
string |
Sim |
O ID da região da imagem personalizada. Você pode chamar DescribeRegions para visualizar a lista mais recente de regiões da Alibaba Cloud. |
cn-hangzhou |
| ImageId |
string |
Sim |
O ID da imagem personalizada. |
m-bp67acfmxazb4p**** |
| OSSBucket |
string |
Sim |
O bucket do OSS de destino para a imagem exportada. |
testexportImage |
| OSSPrefix |
string |
Não |
O prefixo do objeto do OSS. O prefixo deve ter de 1 a 30 caracteres e pode conter letras e dígitos. |
EcsExport |
| ImageFormat |
string |
Não |
O formato do arquivo de imagem exportado. Valores válidos:
Valor padrão: raw. |
raw |
| RoleName |
string |
Não |
O nome da função do RAM usada para exportar a imagem. |
AliyunECSImageExportDefaultRole |
| DryRun |
boolean |
Não |
Especifica se deve ser realizado um dry run para verificar a validade da solicitação sem exportar a imagem de fato. Valores válidos:
Valor padrão: false. |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
|||
| RequestId |
string |
O ID da solicitação. |
C8B26B44-0189-443E-9816-D951F596**** |
| TaskId |
string |
O ID da tarefa de exportação de imagem. |
tsk-bp67acfmxazb4p**** |
| RegionId |
string |
O ID da região. |
cn-hangzhou |
Exemplos
Resposta de sucesso
JSON formato
{
"RequestId": "C8B26B44-0189-443E-9816-D951F596****",
"TaskId": "tsk-bp67acfmxazb4p****",
"RegionId": "cn-hangzhou"
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 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. | |
| 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 | |
| 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 Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.