This topic describes how to use Volcano Engine OpenAPI to quickly purchase an ECS instance by using a custom whole image (that is, a custom image containing both the system volume and data volumes).
tip
You can also purchase an ECS instance in the console. Learn more. Procedure
You can call the RunInstances operation and pass in the target whole image ID by using the ImageId parameter to create one or more ECS instances. The following sections describe how to pass in parameters when you call the operation in scenarios in which you want to modify the volume attributes.
tip
- When you create additional data volumes, make sure that the total number of volumes included in the whole image and the additional volumes does not exceed the maximum number of volumes that can be mounted to a single instance. The number of volumes that can be mounted to an instance varies based on the instance type. For more information, see Instance types.
- The capacity of a volume created from a snapshot must not be less than the capacity of the snapshot. If the specified volume capacity is less than the snapshot capacity, Volcano Engine will use the snapshot capacity by default to create the volume.
Scenario 1: No need to modify the sizes, types, or other attributes of volumes included in the image
Do not pass in the Volumes.N.xxx parameter when you call the operation. In this case, Volcano Engine will create volumes of the corresponding sizes based on the snapshot information associated with the whole image. The default type of these volumes is ESSD_PL0, and they are deleted by default when the instance is deleted.
Scenario 2: Modify certain attributes such as the sizes and types of volumes included in the whole image
- Specify the system volume attribute by using the Volumes.1.xxx parameter.
By default, when you modify the attributes of a volume created from a system volume snapshot included in a whole image, you do not need to pass in the system volume snapshot ID by using the Volumes.1.SnapshotId parameter. Any value you specify for this parameter will be ignored.
- For example, you can use the following configurations to change the system volume capacity to 100 GiB and specify that the volume is deleted when the instance is deleted:
- Pass in the snapshot ID of the target data volume associated with the image by using the Volumes.N(>1).SnapshotId parameter, and specify the volume attribute by using the Volumes.N.xxx parameter.
- For example, you can use the following configurations to change the capacity of the data volume created from the snap-hjdrwnbtxxxx snapshot to 100 GiB and specify that the data volume is deleted when the instance is deleted:
Scenario 3: Create an additional data volume
- Specify attributes such as the size and type of an additional data volume by using the Volumes.N(>1).xxx parameter.
- For example, you can use the following configurations to create a data volume with a capacity of 100 GiB and specify that the data volume is deleted when the instance is deleted:
- You can also pass in the ID of a snapshot that does not belong to the whole image by using the Volumes.N(>1).SnapshotId parameter to create a data volume based on an existing snapshot.
- For example, you can use the following configurations to create a data volume with a capacity of 100 GiB from the snap-ulo8stsgxxxx snapshot and specify that the data volume is deleted when the instance is deleted:
Scenario 4: Create an additional data volume by using a snapshot associated with a whole image
- Pass in the ID of the target snapshot contained in the whole image by using the Volumes.N(>1).SnapshotId parameter, and pass in the Volumes.N.xxx parameter based on your needs to specify volume attributes.
- You can pass in the snapshot ID again by using the Volumes.M(M>N).SnapshotId parameter. You can also modify the attributes of the additional volume you create by using the Volumes.M.xxx parameter.
- For example, you can use the following configurations to create an additional data volume with a capacity of 150 GiB by using the snap-hjdrwnbtxxxx snapshot contained in the image, and specify that the data volume is deleted when the instance is deleted: