阿里云如何使用修改實(shí)例屬性接口
來源:技術(shù)員聯(lián)盟┆發(fā)布時(shí)間:2017-12-10 18:43┆點(diǎn)擊:
修改實(shí)例屬性
描述
修改實(shí)例密碼、實(shí)例名稱、安全組等屬性信息。
此操作只修改參數(shù)中顯式指定了的屬性,沒有指定的屬性將不會(huì)發(fā)生改變。
重置實(shí)例的密碼,狀態(tài)為 Deleted 或 Starting 的實(shí)例不可以進(jìn)行此操作。重置密碼需要重啟實(shí)例后才能生效。
被安全控制在實(shí)例的 OperationLocks 中標(biāo)記了 "LockReason" : "security"的鎖定狀態(tài)時(shí),不能修改密碼。
請(qǐng)求參數(shù)
名稱
類型
是否必須
描述
Action
String
是
系統(tǒng)規(guī)定參數(shù),取值:ModifyInstanceAttribute
InstanceId
String
是
指定的實(shí)例 ID
InstanceName
String
否
實(shí)例的顯示名稱,[2, 128] 英文或中文字符,必須以大小字母或中文開頭,可包含數(shù)字,".","_"或"-"。不能以 和 https:// 開頭。
Description
String
否
實(shí)例的描述,[2, 256] 個(gè)字符。實(shí)例描述會(huì)顯示在控制臺(tái)。默認(rèn)為空。不能以 和 https:// 開頭。
Password
String
否
重置為用戶指定的密。8-30個(gè)字符,必須同時(shí)包含三項(xiàng)(大、小寫字母,數(shù)字和特殊符號(hào))。支持以下特殊字符:( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ' < > , . ? /
如果傳入 Password 參數(shù),請(qǐng)務(wù)必使用 HTTPS 協(xié)議調(diào)用 API 以避免可能發(fā)生的密碼泄露。
HostName
String
否
表示操作系統(tǒng)內(nèi)部的計(jì)算機(jī)名,最少 2 字符,"."和"-"是不能作為 hostname 的首尾字符,不能連續(xù)使用。
Windows 平臺(tái)最長為 15 字符,允許字母(不限制大小寫)、數(shù)字和"-"組成,不支持點(diǎn)號(hào)("."),不能全是數(shù)字。
其他(Linux 等)平臺(tái)最長為 30 字符,允許支持多個(gè)點(diǎn)號(hào),點(diǎn)之間為一段,每段允許字母(不限制大小寫)、數(shù)字和"-"組成。
返回參數(shù)
全是公共返回參數(shù),詳見公共返回參數(shù)
錯(cuò)誤碼
錯(cuò)誤代碼
描述
Http 狀態(tài)碼
語義
InvalidInstanceId.NotFound
The InstanceId provided does not exist in our records.
404
指定的 InstanceId 不存在
MissingParameter
The input parameter "InstanceId" that is mandatory for processing this request is not supplied.
400
缺少 InstanceId 值
InvalidInstanceName.Malformed
The specified parameter "InstanceName" is not valid.
400
指定的 InstanceName 格式不合法
InvalidDescription.Malformed
The specified parameter "Description" is not valid.
400
指定的 Description 格式不合法
InvalidHostPassword.Malformed
The specified parameter "Password" is not valid.
400
指定的 Password 格式不合法
InvalidHostName.Malformed
The specified parameter "HostName" is not valid.
400
指定的 HostName 格式不合法
IncorrectInstanceStatus
The current status of the resource does not support this operation.
403
該資源目前的狀態(tài)不支持此操作
InstanceLockedForSecurity
The specified operation is denied as your instance is locked for security reasons.
403
該資源目前被安全鎖定被拒絕操作
示例
請(qǐng)求示例
https://ecs.aliyuncs.com/?Action=ModifyInstanceAttribute
&InstanceId=i-instance1
&Password=pwd
&<公共請(qǐng)求參數(shù)>
返回示例
XML格式
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"