调用ModifyImageAttribute接口,并可以指定ImageId、ImageFamily等参数,修改一份自定义镜像的属性,例如镜像族系、名称、启动模式、状态以及是否支持NVMe等。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:ModifyImageAttribute |
update |
*Image
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
自定义镜像所在的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| ImageId |
string |
是 |
自定义镜像的 ID。 |
m-bp18ygjuqnwhechc**** |
| ImageName |
string |
否 |
自定义镜像的名称。长度为 2~128 个字符。必须以大小字母或中文开头,不能以 aliyun 或 acs:开头,不能包含 http://或者 https://。可以包含数字、半角句号(.)、半角冒号(:)、下划线(_)或者短划线(-)。 默认值:空,表示保持原有名称不变。 |
testImageName |
| Status |
string |
否 |
镜像状态,取值范围:
说明
如果您需要回滚镜像族系中的自定义镜像至上一个版本,可以将最新可用的自定义镜像设置为弃用状态,但如果该镜像为镜像族系中唯一一个可用状态的自定义镜像,则弃用镜像以后该镜像族系将无可用状态自定义镜像用来创建实例,因此请谨慎操作。 |
Deprecated |
| ImageFamily |
string |
否 |
镜像族系名称。长度为 2~128 个字符。必须以大小字母或中文开头,不能以 aliyun 或 acs:开头,不能包含 http://或者 https://。可以包含数字、半角句号(.)、半角冒号(:)、下划线(_)或者短划线(-)。 默认值:空。 |
hangzhou-daily-update |
| BootMode |
string |
否 |
修改镜像的启动模式。取值范围:
重要
为了避免使用镜像不支持的启动模式导致实例无法正常启动,请您务必在修改之前了解目标镜像支持的启动模式。镜像启动模式详情,请参见镜像启动模式。 枚举值:
|
BIOS |
| LicenseType |
string |
否 |
导入镜像后,激活操作系统采用的许可证类型。当前仅支持 BYOL。 BYOL:源操作系统自带的许可证。采用 BYOL 时,您必须确保您的许可证密钥支持在阿里云使用。 |
BYOL |
| Description |
string |
否 |
自定义镜像的描述信息。长度为 2~256 个字符。不能以 http://或 https://开头。 默认值:空,表示保持原有描述信息不变。 |
testDescription |
| Features |
object |
否 |
镜像特性相关属性。 |
|
| NvmeSupport |
string |
否 |
镜像是否支持 NVMe。可能值:
|
supported |
| ImdsSupport |
string |
否 |
镜像的元数据访问模式,可能值:
|
v2 |
| DryRun |
boolean |
否 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidImageName.Malformed | Image names must be between 2 and 128 characters long, using either English or Chinese characters. The name must start with a letter or a Chinese character, and can include numbers, colons, underscores and hyphens. | 镜像名称的长度为 2~128 个英文或中文字符。必须以大小写字母或中文开头,可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。 |
| 400 | MissingParameter | The input parameter "RegionId" that is mandatory for processing this request is not supplied. | |
| 400 | InvalidImageName.Duplicated | The specified Image name has already bean used. | 镜像名称已经重复。 |
| 400 | InvalidDescription.Malformed | The specified description is wrongly formed. | 指定的资源描述格式不合法。长度为 2-256 个字符,不能以 http:// 和 https:// 开头。 |
| 400 | ImageQuotaFull.ImageFamily | The specified image family has exceeded max number of images for one image family. | |
| 400 | InvalidImageFamily.Malformed | The specified parameter "ImageFamily" is malformed. | |
| 400 | ImageFamilyQuotaFull | The specified region has exceeded max number of image family. | |
| 400 | InvalidBootMode.NotSupport | The specified parameter BootMode is not supported. | |
| 400 | InvalidLicenseType.NotSupported | The specified parameter LicenseType is not supported. | |
| 400 | InvalidParameter.FeaturesImdsSupport | The specified parameter Features.ImdsSupport is not supported. | 指定的参数Features.ImdsSupport不支持。 |
| 403 | ImageStatus.NotAvailable | The specified image status is not available. | 指定的镜像状态不是Available。 |
| 403 | ImageStatus.NotDeprecated | The specified image status is not deprecated. | 指定的镜像状态未弃用。 |
| 403 | ImageUseShared | The specified image has been shared to others, please remove shared accounts first. | |
| 403 | OperationDeined.ImageUsingByInstance | The boot mode of the image cannot be modified because it has associated instances. | 镜像有关联实例时,不允许修改镜像的启动模式属性 |
| 403 | InvalidOperation.FeaturesImdsSupportNotMatch | The specified parameter Features.ImdsSupport can not be set to v1 from v2. | 指定的参数Features.ImdsSupport不能从v2设置成v1. |
| 403 | InvalidStatus.ImageIsCreating | The operation cannot be performed because the image is creating. Please wait until the creation is complete and try again. | 镜像还在创建中,该操作无法执行,请等待创建完毕再重试。 |
| 403 | InvalidOperation.PublicImageUnsupported | The community image's publisher is not the current account. Modification is not permitted. | 社区镜像的发布者不是当前账户。不允许修改。 |
| 403 | InvalidDescription.Malformed | The specified parameter description is not valid. | 指定的参数description无效。 |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的镜像在该用户账号下不存在,请您检查镜像 ID 是否正确。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。