All Products
Search
Document Center

Elastic Compute Service:CreateImagePipeline

Last Updated:Apr 11, 2024

Creates an image template. Image templates can be used to create images.

Operation description

You can use image templates to specify custom image content and create images across regions and accounts. When you call this operation, take note of the following items:

  • You can create only custom image templates.
  • You can configure only public, custom, or shared Linux images or image families as the source images when you create image templates.
  • When you use an image template to create an image, you must create an intermediate Elastic Compute Service (ECS) instance to help create the image. The intermediate instance is billed by using the pay-as-you-go billing method. For more information, see Pay-as-you-go.

For the BuildContent parameter that specifies the content of image templates, take note of the following items:

  • If the BuildContent value contains FROM commands, the FROM commands override the values of BaseImageType that specifies the type of the source images and BaseImage that specifies the source image.
  • If the BuildContent value does not contain FROM commands, the system creates a FROM command that consists of the BaseImageType and BaseImage values in the format of <BaseImageType>:<BaseImage> and adds the command to the first line of the template content.
  • You can use Dockerfile to edit the content of image templates and then pass the edited content into the BuildContent parameter. The content of an image template cannot exceed 16 KB in size and can contain up to 127 commands. For information about commands supported by image templates, see Description of commands supported by Image Builder.

You can use image components to create image templates in the ECS console, but cannot call API operations to use image components to create image templates. For more information, see Overview of Image Builder.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
Tagobject []No

The tags to add to the template.

KeystringNo

The key of tag N. Valid values of N: 1 to 20. You cannot specify empty strings as tag keys. The tag key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with acs: or aliyun.

TestKey
ValuestringNo

The value of tag N. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value must be 0 to 128 characters in length. It cannot start with acs: or contain http:// or https://.

TestValue
RegionIdstringYes

The ID of the region. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ResourceGroupIdstringNo

The ID of the resource group.

rg-bp67acfmxazb4p****
AddAccountarrayNo

The IDs of Alibaba Cloud accounts to which to share the image that will be created based on the image template. You can specify up to 20 account IDs.

longNo

The ID of Alibaba Cloud account N to which to share the image that will be created based on the image template. Valid values of N: 1 to 20.

1234567890
ToRegionIdarrayNo

The IDs of regions to which you want to distribute the image that is created based on the image template. You can specify up to 20 region IDs.

If you do not specify this parameter, the image is created only in the current region.

stringNo

The ID of region N to which to distribute the image that will be created based on the image template. Valid values of N: 1 to 20.

If you do not specify this parameter, the image is created only in the current region.

cn-hangzhou
BaseImageTypestringYes

The type of the source image. Valid values:

  • IMAGE: image
  • IMAGE_FAMILY: image family
IMAGE
BaseImagestringYes

The source image.

  • If you set BaseImageType to IMAGE, set the BaseImage parameter to the ID of a custom image.
  • If you set BaseImageType to IMAGE_FAMILY, set the BaseImage parameter to the name of an image family.
m-bp67acfmxazb4p****
NamestringNo

The name of the image template. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

Note If you do not specify the Name parameter, the return value of ImagePipelineId is used.
testImagePipeline
DescriptionstringNo

The description of the image template. The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

This is description.
ImageNamestringNo

The prefix of the image name. The prefix must be 2 to 64 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

The system generates the final complete image name that consists of the specified prefix and the ID of the build task (ExecutionId) in the format of {ImageName}_{ExecutionId}.

testImageName
VSwitchIdstringNo

The ID of the vSwitch.

If you do not specify this parameter, a new VPC and vSwitch are created. Make sure that the VPC quota in your account is sufficient. For more information, see Limits and quotas.

vsw-bp67acfmxazb4p****
InstanceTypestringNo

The instance type. You can call the DescribeInstanceTypes to query instance types.

If you do not configure this parameter, an instance type that provides the fewest vCPUs and memory resources is automatically selected. This configuration is subject to resource availability of instance types. For example, the ecs.g6.large instance type is automatically selected. If available ecs.g6.large resources are insufficient, the ecs.g6.xlarge instance type is selected.

ecs.g6.large
SystemDiskSizeintegerNo

The system disk size of the intermediate instance. Unit: GiB. Valid values: 20 to 500.

Default value: 40.

40
InternetMaxBandwidthOutintegerNo

The size of the outbound public bandwidth for the intermediate instance. Unit: Mbit/s. Valid values: 0 to 100.

Default value: 0.

0
DeleteInstanceOnFailurebooleanNo

Specifies whether to release the intermediate instance when the image cannot be created. Valid values:

  • true
  • false

Default value: true.

Note If the intermediate instance cannot be started, the instance is released by default.
true
BuildContentstringNo

The content of the image template. The content cannot exceed 16 KB in size and can contain up to 127 commands. For more information about the commands that are supported, see the "Usage notes" section of this topic.

FROM IMAGE:m-bp67acfmxazb4p****
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.**** For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object
ImagePipelineIdstring

The ID of the image template.

ip-2ze5tsl5bp6nf2b3****
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "ImagePipelineId": "ip-2ze5tsl5bp6nf2b3****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidSourceInstance.NotFoundThe specified source instance is not found.-
400InvalidName.Malformed%s-
400InvalidDescription.Malformed%s-
400InvalidImageName.Malformed%s-
400InvalidBaseImageType.NotSupportedValue%s-
400InvalidSystemDiskSize.NotSupportedValue%s-
400InvalidInternetMaxBandwidthOut.NotSupportedValue%s-
400InvalidAddAccountSize.ExceededMaxNumber%s-
400InvalidToRegionIdSize.ExceededMaxNumber%s-
400InvalidBuildContent.LengthExceeded%s-
400InvalidImageTemplateCommandSize.ExceededMaxNumber%s-
400DuplicatedCommand.FROM%s-
400InvalidCommandOrder.FROM%s-
400InvalidImageTemplateCommand.NotSupported%s-
400InvalidCommandContent.RUN%s-
400InvalidCommandContent.ENV%s-
400InvalidCommandContent.WORKDIR%s-
400InvalidCommandContent.COPY%s-
400InvalidCommandContent.USER%s-
400InvalidCommandContent.FROM%s-
400InvalidCommandContent.CMD%s-
400InvalidCommandContent.ENTRYPOINT%s-
400QuotaExceed.ImagePipeline%s.The image template quota of your account in this region is used up.
400NoPermission%s.This operation is not allowed. Apply for the permissions required to perform the operation.
400EmptyCommandContent.LABEL%s.If the LABEL command exists in the template, you must specify LABEL.
400EmptyCommandContent.ENV%s.If the ENV command exists in the template, you must specify ENV.
400EmptyCommandContent.ENTRYPOINT%s.If the ENTRYPOINT command exists in the template, you must specify ENTRYPOINT.
400EmptyCommandContent.CMD%s.If the CMD command exists in the template, you must specify CMD.
400EmptyCommandContent.COPY%s.If the COPY command exists in the template, you must specify COPY.
400EmptyCommandContent.WORKDIR%s.If the WORKDIR command exists in the template, you must specify WORKDIR.
400NotEmptyCommandContent.RESTART%s.If the RESTART command exists in the template, you must specify RESTART.
400EmptyCommandContent.USER%s.If the USER command exists in the template, you must specify USER.
400EmptyCommandContent.RUN%s.If the RUN command exists in the template, you must specify RUN.
403ImagePipeline.NotSupportWindowsInstanceImage pipeline does not support windows instance at this time.-
404ImageComponent.NotFound%s-
404InvalidImage.NotFound%s-
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-03-28The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 403