All Products
Search
Document Center

Elastic Compute Service:CreateImagePipeline

更新時間:Dec 24, 2024

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

Operation description

Usage notes

You can use image templates to customize image content and create images across regions and accounts. 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 create an image from an image template, an intermediate Elastic Compute Service (ECS) instance that uses the pay-as-you-go billing method is created. You are charged for the instance. For more information, see Pay-as-you-go.

When you use the BuildContent parameter to specify the content of the image template, 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 image 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 the image template and then pass the edited content into the BuildContent parameter. The content cannot be greater than 16 KB in size and can contain up to 127 commands. For information about commands supported by image templates, see 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 What is Image Builder.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:CreateImagePipelinecreate
*ImagePipeline
acs:ecs:{#regionId}:{#accountId}:imagepipeline/*
    none
  • ram:CreateServiceLinkedRole

Request parameters

ParameterTypeRequiredDescriptionExample
Tagarray<object>No

The tags to add to the template.

objectNo

The tag 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 launch template. The name must be 2 to 128 characters in length. The name must start with a letter and cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

Note If you do not specify Name, 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. The prefix must start with a letter and cannot start with http:// or https://. The prefix 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
RepairModestringNo
Note This parameter is in invitational preview and is not publicly available.
null
ImageFamilystringNo
Note This parameter is in invitational preview and is not publicly available.
null
TestContentstringNo
Note This parameter is in invitational preview and is not publicly available.
null

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.The 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.
400InvalidImage.OsTypeUnsupportedThe specified base image does not support image building.-
400InvalidParameter.BuildContent%s.The build content is invalid.
400InvalidParameter.TestContent%s.The test content is invalid.
400InvalidImageComponent.NotSupported%s.The specified image component is not available.
400InvalidParameterCombination%s.Invalid combination of parameters.
400InvalidParameter.RepairModeThe specified parameter RepairMode is invalid.-
400InvalidImageFamily.MalformedThe format of the specified image family is invalid.The format of the specified image family is invalid.
400InvalidImage.ImageOwnerAliasUnsupportedThe specified base image does not support distributing.The specified base image does not support distributing.
403ImagePipeline.NotSupportWindowsInstanceImage pipeline does not support windows instance at this time.-
404InvalidImage.NotFound%s-
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.
404ImageComponent.NotFound%s.The specified image component ID is not found.
404InvalidInstanceType.NotFoundThe specified instance type does not exist.The specified InstanceType parameter does not exist.
404InvalidVSwitchId.NotFoundThe specified VSwitchId does not exist.The specified VSwitchId does not exist
404InvalidRegionId.NotFound%sThe specified region ID does not exist.

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

Change history

Change timeSummary of changesOperation
2024-10-10The Error code has changed. The request parameters of the API has changedView Change Details
2023-03-28The Error code has changedView Change Details