Cria um modelo de imagem para gerar imagens.
Descrição da operação
API
Você pode usar um modelo de imagem para personalizar o conteúdo da imagem e gerar imagens em várias regiões e contas. Antes de criar um modelo de imagem, considere o seguinte:
-
Você pode criar apenas modelos de imagem personalizados.
-
Você pode usar apenas imagens públicas, imagens personalizadas, imagens compartilhadas ou famílias de imagens como imagem de origem.
-
Ao gerar uma imagem usando um modelo de imagem, o sistema cria uma ou mais instâncias de trânsito para auxiliar na criação. Você será cobrado por essas instâncias ECS pagas conforme o uso. Para mais informações, consulte pagas conforme o uso.
Considere o seguinte sobre o conteúdo de criação especificado em BuildContent:
-
O comando
FROMfoi descontinuado. O sistema ignora o comandoFROMemBuildContente, em vez disso, usa os parâmetrosBaseImageTypeeBaseImagepara selecionar a imagem de origem. -
O conteúdo de um modelo de imagem não pode exceder 16 KB. Para obter detalhes sobre os comandos suportados, consulte Referência de comandos do Image Builder.
Para mais informações, consulte Visão geral do Image Builder.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
ecs:CreateImagePipeline |
create |
*ImagePipeline
|
Nenhuma |
|
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| Tag |
array<object> |
Não |
As tags a serem adicionadas ao pipeline de imagens. |
|
|
object |
Não |
Uma lista de tags. |
||
| Key |
string |
Não |
A chave da tag N, onde N varia de 1 a 20. A chave da tag deve ter de 1 a 128 caracteres. Não pode começar com |
TestKey |
| Value |
string |
Não |
O valor da tag N, onde N varia de 1 a 20. O valor da tag pode estar vazio ou ter até 128 caracteres. Não pode começar com |
TestValue |
| RegionId |
string |
Sim |
O ID da região. Você pode chamar a operação DescribeRegions para consultar a lista mais recente de regiões da Alibaba Cloud. |
cn-hangzhou |
| ResourceGroupId |
string |
Não |
O ID do grupo de recursos. |
rg-bp67acfmxazb4p**** |
| AddAccount |
array |
Não |
Os IDs das contas da Alibaba Cloud com as quais as imagens de destino serão compartilhadas. Você pode especificar até 20 IDs de conta. |
1234567890 |
|
integer |
Não |
O ID de uma conta da Alibaba Cloud com a qual as imagens de destino serão compartilhadas. |
1234567890 |
|
| ToRegionId |
array |
Não |
Os IDs das regiões de destino para distribuição de imagens. Você pode especificar até 20 IDs de região. Se você não especificar este parâmetro, as imagens serão criadas apenas na região atual. |
cn-hangzhou |
|
string |
Não |
O ID de uma região de destino para distribuição de imagens. |
cn-hangzhou |
|
| BaseImageType |
string |
Sim |
O ID da região. Você pode chamar a operação DescribeRegions para consultar a lista mais recente de regiões da Alibaba Cloud. |
IMAGE |
| BaseImage |
string |
Não |
O ID do grupo de recursos. |
m-bp67acfmxazb4p**** |
| Name |
string |
Não |
O tipo da imagem base. Valores válidos:
|
testImagePipeline |
| Description |
string |
Não |
A imagem base. O valor deste parâmetro varia com base no valor de
|
This is description. |
ImageName
deprecated
|
string |
Não |
O nome do pipeline de imagens. Deve ter de 2 a 128 caracteres, começar com uma letra ou um caractere chinês e não pode começar com Nota
Se você não especificar este parâmetro, o valor de |
testImageName |
| VSwitchId |
string |
Não |
A descrição do modelo de pipeline de imagens. A descrição deve ter de 2 a 256 caracteres e não pode começar com |
vsw-bp67acfmxazb4p**** |
| InstanceType |
string |
Não |
O prefixo do nome da imagem de destino. Importante Este parâmetro foi descontinuado. Use ImageOptions.ImageName em seu lugar. |
ecs.g6.large |
| SystemDiskSize |
integer |
Não |
O ID do VSwitch na VPC que é usado para iniciar a instância intermediária. Se você não especificar este parâmetro, uma nova VPC e um novo VSwitch serão criados. Certifique-se de ter uma cota suficiente de recursos de VPC. Para mais informações, consulte Limites de uso. |
40 |
| InternetMaxBandwidthOut |
integer |
Não |
O tipo de instância da instância intermediária. Você pode chamar a operação DescribeInstanceTypes para consultar os tipos de instância. Se você não especificar este parâmetro, o sistema selecionará automaticamente um tipo de instância com o mínimo de vCPUs e memória, sujeito ao estoque. Por exemplo, |
0 |
| DeleteInstanceOnFailure |
boolean |
Não |
O tamanho do disco do sistema da instância intermediária. Unidade: GiB. Valores válidos: 20 a 500. Valor padrão: 40. |
true |
| BuildContent |
string |
Não |
A largura de banda pública de saída da instância intermediária. Unidade: Mbit/s. Valores válidos: 0 a 100. Valor padrão: 0. |
COMPONENT ic-bp12dvdzvr9k9***** COMPONENT acs:ecs:cn-hangzhou:18689161186*****:imagecomponent/ComponentName/1.*.* |
| ClientToken |
string |
Não |
Determina se a instância intermediária deve ser liberada quando a criação da imagem falhar. Valores válidos:
Valor padrão: true. Nota
Se uma instância intermediária não puder ser iniciada, ela não será retida por padrão. |
123e4567-e89b-12d3-a456-426655440000 |
| RepairMode |
string |
Não |
O conteúdo do modelo de criação de imagem. O conteúdo pode ter até 16 KB de tamanho. Para mais informações sobre os comandos suportados, consulte Referência de comandos do Image Builder. |
Standard |
ImageFamily
deprecated
|
string |
Não |
Um token globalmente exclusivo gerado pelo cliente para garantir a idempotência da solicitação. O valor de ClientToken pode conter apenas caracteres ASCII e não pode exceder 64 caracteres. Para mais informações, consulte Como garantir a idempotência. |
family |
| TestContent |
string |
Não |
O modo de reparo de imagem no modelo de imagem. Valores válidos:
Nota
Os itens de reparo podem mudar à medida que os recursos de verificação e reparo forem aprimorados. Para mais informações sobre cada item de reparo, consulte Visão geral da verificação de imagem. |
COMPONENT ic-bp12dvdzvr9k9***** COMPONENT acs:ecs:cn-hangzhou:18689161186*****:imagecomponent/ComponentName/1.*.* |
| ImportImageOptions |
object |
Não |
O nome da família de imagens de destino. Importante Este parâmetro foi descontinuado. Use ImageOptions.ImageFamily em seu lugar. |
|
| Architecture |
string |
Não |
The architecture of the image to import. Valid values:
Default value: x86_64. |
x86_64 |
| OSType |
string |
Não |
The type of the operating system. Valid values:
Default value: linux. |
linux |
| Platform |
string |
Não |
The operating system distribution. Valid values:
Default value: Others Linux if OSType is set to Linux, or Other Windows if OSType is set to Windows. |
Aliyun |
| BootMode |
string |
Não |
The boot mode of the image. Valid values:
Default value: BIOS. If Importante
To prevent startup failures, ensure the boot mode is supported by the image. |
BIOS |
| LicenseType |
string |
Não |
The license type used to activate the operating system after the image is imported. Valid values:
Default value: Auto. |
Auto |
| DiskDeviceMappings |
array<object> |
Não |
The information about the disks of the custom image.
|
|
|
object |
Não |
|||
| OSSBucket |
string |
Não |
The OSS bucket that contains the image file. |
ecsimageos |
| OSSObject |
string |
Não |
The name (key) of the image file that is stored in the OSS bucket. |
CentOS_5.4_32.raw |
| Format |
string |
Não |
The format of the image. Valid values:
Default value: If left empty, the system automatically detects the image format. |
RAW |
| DiskImageSize |
integer |
Não |
The size of the disk to create from the image file, in GiB. For the system disk, this value must be greater than or equal to the size of the image file. Valid values:
After you upload the base image file to an OSS bucket, you can view the size of the image file in the bucket. |
40 |
| Features |
object |
Não |
The image feature attributes. |
|
| NvmeSupport |
string |
Não |
Specifies whether the base image to be imported supports NVMe. Valid values:
Default value: unsupported. |
supported |
| ImdsSupport |
string |
Não |
||
| RetainImportedImage |
boolean |
Não |
Nota
This parameter is in invitational preview. |
false |
| RetentionStrategy |
string |
Não |
||
| ImageName |
string |
Não |
||
| Description |
string |
Não |
||
| RoleName |
string |
Não |
||
| ImportImageTags |
array<object> |
Não |
||
|
object |
Não |
|||
| Key |
string |
Não |
||
| Value |
string |
Não |
||
NvmeSupport
deprecated
|
string |
Não |
O conteúdo do modelo de teste de imagem. O conteúdo pode ter até 16 KB de tamanho. Para mais informações sobre os comandos suportados, consulte Referência de comandos do Image Builder. |
auto |
| AdvancedOptions |
object |
Não |
As configurações para importação de uma imagem. Este parâmetro é obrigatório quando |
|
| RetainCloudAssistant |
boolean |
Não |
Specifies whether to retain Cloud Assistant in the destination image. During the image building process, Cloud Assistant is automatically installed on the intermediate instance to run commands. You can select whether to retain Cloud Assistant after the process is complete. Valid values:
Default value: false. Nota
This setting does not affect the Cloud Assistant client that is already installed in your image. |
true |
| ImageNameSuffix |
string |
Não |
Specifies whether to disable the feature that automatically appends a suffix to the destination image name. Valid values:
|
disable |
| Description |
Não |
|||
| Architecture |
Não |
A arquitetura da imagem a ser importada. Valores válidos:
Valor padrão: x86_64. |
||
| Platform |
Não |
A distribuição do sistema operacional. Valores válidos:
Valor padrão: Others Linux se OSType estiver definido como Linux, ou Other Windows se OSType estiver definido como Windows. |
||
| BootMode |
Não |
O modo de inicialização da imagem. Valores válidos:
Valor padrão: BIOS. Se Importante
Para evitar falhas de inicialização, certifique-se de que o modo de inicialização seja suportado pela imagem. . |
||
| LicenseType |
Não |
O tipo de licença usado para ativar o sistema operacional após a importação da imagem. Valores válidos:
Valor padrão: Auto. |
||
| ImageName |
Não |
|||
| DiskDeviceMappings |
Não |
As informações sobre os discos da imagem personalizada.
|
||
| RoleName |
Não |
|||
| RetentionStrategy |
Não |
|||
| OSType |
Não |
O tipo do sistema operacional. Valores válidos:
Valor padrão: linux. |
||
| RetainImportedImage |
Não |
Nota
Este parâmetro está em pré-visualização por convite. |
||
| Features |
Não |
Os atributos de recursos da imagem. |
||
| ImportImageTags |
Não |
|||
| ImageOptions |
object |
Não |
Especifica se a imagem de destino suporta NVMe. Importante Este parâmetro foi descontinuado. Use ImageOptions.ImageFeatures.NvmeSupport em seu lugar. |
|
| ImageName |
string |
Não |
The prefix of the destination image name. The prefix must be 2 to 64 characters in length. It must start with a letter or a Chinese character. It cannot start with The complete image name is automatically generated by concatenating the prefix and the build task ID ( |
testImageName |
| ImageFamily |
string |
Não |
The name of the destination image family. The name must be 2 to 128 characters long and start with a letter or a Chinese character. It cannot start with |
family |
| Description |
string |
Não |
The description of the destination image. The description must be 2 to 256 characters in length and cannot start with |
This is description. |
| ImageFeatures |
object |
Não |
The feature attributes of the destination image. |
|
| NvmeSupport |
string |
Não |
Specifies whether the destination image supports NVMe. Valid values:
|
auto |
| ImageTags |
array<object> |
Não |
The tags of the destination image. |
|
|
object |
Não |
|||
| Key |
string |
Não |
The key of the tag. The tag key must be 1 to 128 characters in length, cannot start with |
TestKey |
| Value |
string |
Não |
The value of the tag. The tag value can be empty or up to 128 characters long. It cannot start with |
TestValue |
|
Não |
As configurações avançadas. |
|||
|
Não |
As propriedades da imagem de destino. |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
|||
| ImagePipelineId |
string |
O ID do pipeline de imagens. |
ip-2ze5tsl5bp6nf2b3**** |
| RequestId |
string |
O ID da solicitação. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Exemplos
Resposta de sucesso
JSON formato
{
"ImagePipelineId": "ip-2ze5tsl5bp6nf2b3****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | InvalidSourceInstance.NotFound | The specified source instance is not found. | |
| 400 | InvalidName.Malformed | %s | |
| 400 | InvalidDescription.Malformed | %s | |
| 400 | InvalidImageName.Malformed | %s | |
| 400 | InvalidBaseImageType.NotSupportedValue | %s | |
| 400 | InvalidSystemDiskSize.NotSupportedValue | %s | |
| 400 | InvalidInternetMaxBandwidthOut.NotSupportedValue | %s | |
| 400 | InvalidAddAccountSize.ExceededMaxNumber | %s | |
| 400 | InvalidToRegionIdSize.ExceededMaxNumber | %s | |
| 400 | InvalidBuildContent.LengthExceeded | %s | |
| 400 | InvalidImageTemplateCommandSize.ExceededMaxNumber | %s | |
| 400 | DuplicatedCommand.FROM | %s | |
| 400 | InvalidCommandOrder.FROM | %s | |
| 400 | InvalidImageTemplateCommand.NotSupported | %s | |
| 400 | InvalidCommandContent.RUN | %s | |
| 400 | InvalidCommandContent.ENV | %s | |
| 400 | InvalidCommandContent.WORKDIR | %s | |
| 400 | InvalidCommandContent.COPY | %s | |
| 400 | InvalidCommandContent.USER | %s | |
| 400 | InvalidCommandContent.FROM | %s | |
| 400 | InvalidCommandContent.CMD | %s | |
| 400 | InvalidCommandContent.ENTRYPOINT | %s | |
| 400 | QuotaExceed.ImagePipeline | %s. | |
| 400 | NoPermission | %s. | |
| 400 | EmptyCommandContent.LABEL | %s. | |
| 400 | EmptyCommandContent.ENV | %s. | |
| 400 | EmptyCommandContent.ENTRYPOINT | %s. | |
| 400 | EmptyCommandContent.CMD | %s. | |
| 400 | EmptyCommandContent.COPY | %s. | |
| 400 | EmptyCommandContent.WORKDIR | %s. | |
| 400 | NotEmptyCommandContent.RESTART | %s. | |
| 400 | EmptyCommandContent.USER | %s. | |
| 400 | EmptyCommandContent.RUN | %s. | |
| 400 | InvalidImage.OsTypeUnsupported | The specified base image does not support image building. | |
| 400 | InvalidParameter.BuildContent | %s. | |
| 400 | InvalidParameter.TestContent | %s. | |
| 400 | InvalidImageComponent.NotSupported | %s. | |
| 400 | InvalidParameterCombination | %s. | |
| 400 | InvalidParameter.RepairMode | The specified parameter RepairMode is invalid. | |
| 400 | InvalidImageFamily.Malformed | The format of the specified image family is invalid. | |
| 400 | InvalidImage.ImageOwnerAliasUnsupported | The specified base image does not support distributing. | |
| 400 | InvalidParameter.ImportImageOptionsArchitecture | The specified parameter ImportImageOptions.Architecture is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.ImportImageOptionsOSType | The specified parameter ImportImageOptions.OSType is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.ImportImageOptionsBootMode | The specified parameter ImportImageOptions.BootMode is invalid. The correct value should be in [%s]. | |
| 400 | InvalidImportImageOptionsDiskDeviceMappings.LengthLimitExceeded | The length of the specified parameter ImportImageOptions.DiskDeviceMappings exceeds the limit(17). | |
| 400 | InvalidParameter.ImportImageOptionsDiskDeviceMappingsOSSObject | The specified parameter ImportImageOptions.DiskDeviceMappings.OSSObject is invalid. OSSObject supports up to 1023 characters, and cannot start with http:// or https://. | |
| 400 | InvalidParameter.ImportImageOptionsDiskDeviceMappingsOSSBucket | The specified parameter ImportImageOptions.DiskDeviceMappings.OSSBucket is invalid. OSSBucket supports up to 63 characters, only lowercase letters, numbers, and dashes are allowed, and cannot start or end with a dash. | |
| 400 | InvalidParameter.ImportImageOptionsPlatform | The specified parameter ImportImageOptions.Platform is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.ImportImageOptionsLicenseType | The specified parameter ImportImageOptions.LicenseType is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.ImportImageOptionsFeaturesNvmeSupport | The specified parameter ImportImageOptions.Features.NvmeSupport is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.NvmeSupport | The specified parameter NvmeSupport is invalid. The correct value should be in [%s]. | |
| 400 | InvalidParameter.ImportImageOptionsDiskDeviceMappingsFormat | The specified parameter ImportImageOptions.DiskDeviceMappings.Format is invalid. The correct value should be in [%s]. | |
| 400 | InvalidOperation.DiskImageSizeExceeded | The disk size exceeds the limit. Please check the specified parameter ImportImageOptions.DiskDeviceMappings.DiskImageSize and ImportImageOptions.DiskDeviceMappings.OSSObject. Ensure that each of them is between 1 and 2048 in size. | |
| 400 | InvalidImageOptions.Description | The specified parameter ImageOptions.Description is invalid. The length should be between 2 to 256 characters, and cannot start with http:// or https://. | |
| 400 | InvalidImageName.Duplicated | The specified image name is already in use in the target region. Please try a different one. | |
| 400 | InvalidImage.NotSupportRepair | The specified base image does not support repair. | |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | |
| 400 | InvalidTagKey.Malformed | The specified Tag.N.Key is not valid. Tag keys cannot be empty or null, support up to 128 characters, cannot start with "aliyun" or "acs:", and cannot contain "http://" or "https://". | |
| 400 | InvalidTagValue.Malformed | The specified Tag.N.Value is not valid. Tag values support up to 128 characters, and cannot contain "http://" or "https://". | |
| 400 | InvalidAdvancedOptions.ImageNameSuffix | The specified parameter AdvancedOptions.ImageNameSuffix is invalid. The correct value should be in [%s]. | |
| 400 | InvalidImportImageOptions.DockerOptionsImageMalformed | The specified parameter ImportImageOptions.DockerOptions.Image is invalid. The length should be between 1 to 512 characters. | |
| 400 | InvalidImportImageOptions.DockerOptionsImageSizeMalformed | The specified parameter ImportImageOptions.DockerOptions.ImageSize is invalid. The size should be between 1GB to 2048GB. | |
| 403 | ImagePipeline.NotSupportWindowsInstance | Image pipeline does not support windows instance at this time. | |
| 403 | InvalidOSSObject.NotAuthorized | The specified ImportImageOptions.DiskDeviceMappings.OSSObject is not allowed to be accessed. | |
| 403 | InvalidOperation.NoPermissionCreateServiceLinkedRole | You are not authorized to create Service-linked role. The system will automatically create it when the API is called for the first time. Check your RAM policies, and ensure that you are using the correct credentials. | |
| 403 | InvalidOSSObject.NeedRestore | The specified ImportImageOptions.DiskDeviceMappings.OSSObject is an archived object and needs to be restored first. | |
| 403 | InvalidOperation.NoRightAccessOSS | ECS service is not authorized to access your OSS. Check your RAM roles and policies, and ensure that ecs.aliyuncs.com is authorized to assume AliyunECSImageImportDefaultRole. | |
| 403 | InvalidOperation.OSSObjectIsImporting | The specified ImportImageOptions.DiskDeviceMappings.OSSObject is importing. | |
| 404 | InvalidImage.NotFound | %s | |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | |
| 404 | ImageComponent.NotFound | %s. | |
| 404 | InvalidInstanceType.NotFound | The specified instance type does not exist. | |
| 404 | InvalidVSwitchId.NotFound | The specified VSwitchId does not exist. | |
| 404 | InvalidRegionId.NotFound | %s | |
| 404 | InvalidImportImageOptionsDiskDeviceMappingsOSSObject.NotFound | The specified ImportImageOptions.DiskDeviceMappings.OSSObject is not found in this region. | |
| 404 | MissingParameter.RepairMode | The specified parameter RepairMode is missing. | |
| 404 | MissingParameter.ImportImageOptions | The specified parameter ImportImageOptions is missing. | |
| 404 | MissingParameter.ImportImageOptionsDiskDeviceMappingsOSSObject | The specified parameter ImportImageOptions.DiskDeviceMappings.OSSObject is missing. | |
| 404 | MissingParameter.ImportImageOptionsDiskDeviceMappingsOSSBucket | The specified parameter ImportImageOptions.DiskDeviceMappings.OSSBucket is missing. | |
| 404 | MissingParameter.ImageOptionsDiskDeviceMappings | The specified parameter ImportImageOptions.DiskDeviceMappings is missing. | |
| 404 | MissingImportImageOptions.DockerOptions | The specified parameter ImportImageOptions.DockerOptions is missing. | |
| 404 | InvalidOssBucketName.NotFound | The specified parameter OssDeliveryConfig.BucketName does not exist. |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.