Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of importing an existing image file to the ECS and appearing in the region as a custom image

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the method of importing existing image files into CVM ECS and appearing in the region as a custom image. It is very detailed and has a certain reference value. Friends who are interested must finish reading it.

ImportImage

Description

After importing a custom image, you can use the created custom image to create an ECS instance (RunInstances) or change the instance's system disk (ReplaceSystemDisk). When calling this interface, you need to be aware of:

You must upload the image file to the object store OSS in advance.

The region in which the image is imported must be the same as the region of the OSS Bucket uploaded by the image file.

The value range of n in parameter DiskDeviceMapping.n is [1,17]. N = 1 indicates the system disk, and n = [2,17] represents the data disk.

You cannot delete the mirror you are importing, you can only cancel the import mirror task (CancelTask).

You need to authorize ECS access to OSS for you in advance through the access control RAM service. Refer to the following steps:

Create a role AliyunECSImageImportDefaultRole. This must be the name, or the import of the image will fail. The strategy for the role is:

{"Statement": [{"Action": "sts:AssumeRole", "Effect": "Allow", "Principal": {"Service": ["ecs.aliyuncs.com"]}}], "Version": "1"}

Under this role, add the permission policy AliyunECSImageImportRolePolicy. This policy is the default policy for ECS to import images, or you can create a custom policy with permissions that include:

{"Version": "1", "Statement": [{"Action": ["oss:GetObject", "oss:GetBucketLocation"], "Resource": "*", "Effect": "Allow"}]}

Request parameter

Return parameters

Example

Request example

Https://ecs.aliyuncs.com/?Action=ImportImage&RegionId=cn-hangzhou&DiskDeviceMapping.1.OSSBucket=ecsimageos&DiskDeviceMapping.1.OSSObject=CentOS_5.4_32.raw&

Return the example

XML format

C8B26B44-0189-443E-9816-D951F59623A9 Img-231234567 12345-2332-22323

JSON format

{"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9", "ImageId": "Img-231234567", "ImportTaskId": "123345-2332-22323"}

Error code

The following are the error codes specific to this API. For more error codes, please visit the API error Center.

The above is all the contents of the method of importing the existing image file to the CVM ECS and appearing in the region as a custom image. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report