Assign an image family to a custom image during creation or by editing its properties.
Procedure
Set an image family in the console
-
Set an image family in one of the following ways:
-
Set an image family when you create a custom image from an instance or create a custom image from a snapshot.
-
After the image is created, modify the image properties to set an image family.
Enter a custom name to create a new image family, or select an existing one.
NoteThe name must be 2 to 128 characters in length. It cannot start with a special character, a digit,
http://, orhttps://. It can contain only periods (.), underscores (_), hyphens (-), and colons (:). -
-
(Optional) View the image family.
-
In the upper-right corner of the image list, click the
icon. -
In the Image Family section, click a family name to view its images.
-
Set an image family using an API operation
Call the CreateImage API operation to set an image family when you create a custom image.
-
Log on to OpenAPI Explorer.
-
Call the CreateImage operation to create a custom image and set its image family.
This example creates a custom image from an instance and sets the image family to
hangzhou-image. Set the following request parameters:-
RegionId: The region ID. Example:
cn-hangzhou. -
InstanceId: The instance ID. Example:
i-bp117mtgmllecpwl****. -
ImageFamily: The image family name. Example:
hangzhou-image.
The custom image ID is returned.
{ "RequestId": "46BC46F8-922C-4419-8B5D-E713F663E00A", "ImageId": "m-bp1hxxx" } -
-
Call the DescribeImages operation to verify the image family of the image created in the previous step.
Set the following request parameters:
-
RegionId: Same region as the previous step.
-
ImageId: The custom image ID from the previous step.
The response shows
ImageFamilyashangzhou-image.}, "Status": "Available", "Progress": "100%", "Usage": "none", "Architecture": "x86_64", "ProductCode": "", "IsCopied": false, "ImageFamily": "hangzhou-image", "IsSupportIoOptimized": true, "IsSupportCloudinit": true, "ImageName": "m-bp1h46wfpjxxx", "DiskDeviceMappings": { "DiskDeviceMapping": [ { "SnapshotId": "s-bp1h4xxx", "Type": "system", "Progress": "", -
References
-
To change the image family, modify the image properties or call the ModifyImageAttribute operation.
-
After you set an image family, you can create an ECS instance from an image family.