All Products
Search
Document Center

Elastic Compute Service:CreateImageComponent

Last Updated:Mar 19, 2024

Creates an image component. Image components are used to store the image template commands that are commonly used to create images.

Operation description

Take note of the following items:

  • Only custom image components can be created.
  • The images must run Linux operating systems. This indicates that you must set SystemType to Linux.
  • You must set the image component type to image build component by setting the ComponentType parameter to Build.
  • You can use Dockerfile to edit the content of image components, and then pass the edited content into the Content parameter. The content size must not be greater than 16 KB. FROM commands cannot be used in image components. An image component supports up to 127 commands. For information about supported commands, see Description of commands supported by Image Builder.

You can use image components to create image templates in the Elastic Compute Service (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
RegionIdstringYes

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

cn-hangzhou
ResourceGroupIdstringNo

The ID of the resource group.

rg-bp67acfmxazb4p****
Tagobject []No

The tags.

KeystringNo

The key of tag N. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key 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 can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs:.

TestValue
NamestringNo

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

Note If you do not configure Name, the return value of ImageComponentId is used.
testComponent
DescriptionstringNo

The description. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

This is description.
SystemTypestringNo

The operating system type supported by the image component. Only Linux is supported. Set the value to Linux.

Default value: Linux.

Linux
ComponentTypestringNo

The type of the image component. Only image build components are supported. Set the value to Build.

Default value: Build.

Build
ContentstringNo

The content of the image component. The content consists of up to 127 commands.

RUN yum update -y
ClientTokenstringNo

The client token that is used to ensure the idempotency 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
ImageComponentIdstring

The ID of the image component.

ic-bp67acfmxazb4p****
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "ImageComponentId": "ic-bp67acfmxazb4p****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidCommand.ComponentImage component does not support component command.-
400InvalidName.Malformed%s-
400InvalidDescription.Malformed%s-
400InvalidSystemType.NotSupportedValue%s-
400InvalidComponentType.NotSupportedValue%s-
400InvalidContent.LengthExceeded%s-
400InvalidImageTemplateCommandSize.ExceededMaxNumber%s-
400InvalidImageTemplateCommand.NotSupported%s-
400InvalidCommandContent.RUN%s-
400InvalidCommandContent.ENV%s-
400InvalidCommandContent.WORKDIR%s-
400InvalidCommandContent.COPY%s-
400InvalidCommandContent.USER%s-
400InvalidCommandContent.CMD%s-
400InvalidCommandContent.ENTRYPOINT%s-
400MissingParameter.Content%s-
400EmptyCommandContent.RUN%s.If the RUN command exists in the template, you must specify RUN.
400EmptyCommandContent.ENV%s.If the ENV command exists in the template, you must specify ENV.
400EmptyCommandContent.LABEL%s.If the LABEL command exists in the template, you must specify LABEL.
400EmptyCommandContent.COPY%s.If the COPY command exists in the template, you must specify COPY.
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.
400NotEmptyCommandContent.RESTART%s.If the RESTART command exists in the template, you must specify RESTART.
400EmptyCommandContent.WORKDIR%s.If the WORKDIR command exists in the template, you must specify WORKDIR.
400EmptyCommandContent.USER%s.If the USER command exists in the template, you must specify USER.
400QuotaExceed.ImageComponent%s.Image component quota exceeded in current region.
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.
404NotSupportedCommand.FROM%s-

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 400 change
    delete Error Codes: 404