ModifyInstanceAttribute

Last Updated: Jan 29, 2018

Description

Modifies the information of an ECS instance, such as the name, password, host name, and description of an instance. When you call this interface, consider the following:

  • Only modify the information explicitly specified in the request. Unspecified properties are not modified.

  • You cannot reset the password for an instance when it is in the Deleted or Starting status. The new password takes effect after the instance is restarted in the console or by calling the interface RebootInstance.

  • If the specified instance is locked, and the OperationLocks of the instance indicates "LockReason" : "security", you cannot reset its password.

  • When an instance is in the Stopped status and is not limited to pass a user-defined script, you can modify its user-defined.

  • You must encode your UserData in the means of Base64 before you pass the content in your request. Do not contain confidential information, such as SSH key pair and Access Key, in your request. Otherwise, you must encrypt the confidential information before encode it is the means of Base64, and do not forget to decrypt the information after they are passed into your ECS instance.

  • The size of your UserData must be less than 16 KB before the Base64 encodement.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: ModifyInstanceAttribute.
InstanceId String Yes The specified instance ID.
InstanceName String No The name of the instance can be 2 to 128 characters in length and:
  • Must begin with an uppercase or lowercase English letter, or Chinese character.
  • Can contain digits, dots (.), underscores (_), and hyphens (-).
  • Cannot begin with http:// or https://.
Description String No The description of the instance is null by default. It can be 2 to 256 characters in length, but cannot begin with http:// or https://. The instance description is displayed on the Alibaba Cloud console.
Password String No Reset the administrative password of the instance. The password must be 6 to 30 characters in length and can only contain digits, and/or alphabets.
HostName String No Name of the instance. It cannot start or end with dot (.) or hyphens (-) and it cannot have two or more consecutive dots (.) or hyphens (-) symbols.
For a Windows instance, the host name:
  • can be up to [2, 15] characters in length.
  • Can contain uppercase or lowercase letters.
  • Can contain digits, dots (.), and hyphens (-).
  • Cannot contain only numeric characters.
For a Linux instance, the host name:
  • can be up to [2, 128] characters in length.
  • Can be segments separated by dots (.).
  • Segments can contain uppercase or lowercase letters, digits, or underscores (_).
UserData String No The user-defined data of your ECS instance. The size of your UserData must be less than 16 KB before the Base64 encodement.

Response parameters

All parameters are common response parameters. For more information, see Common parameters.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=ModifyInstanceAttribute
  2. &InstanceId=i-instance1
  3. &Password=pwd
  4. &<Common Request Parameters>

Response example

XML format

  1. <ModifyInstanceAttributeResponse>
  2. <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
  3. </ModifyInstanceAttributeResponse>

JSON format

  1. {
  2. "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
  3. }

Error codes

Error code Error message HTTP status code Meaning
InvalidDescription.Malformed The specified parameter “Description” is not valid. 400 The specified Description is invalid.
InvalidHostName.Malformed The specified parameter “HostName” is not valid. 400 The specified HostName is invalid.
InvalidHostPassword.Malformed The specified parameter “Password” is not valid. 400 The specified Password is invalid.
InvalidInstanceName.Malformed The specified parameter “InstanceName” is not valid. 400 The specified InstanceName is invalid.
InvalidPassword.Malformed The specified parameter “Password” is not valid. 400 The specified Password is invalid.
InvalidUserData.NotSupported The specified parameter “UserData” only support the vpc and IoOptimized Instance. 400 You can only specify UserData for a VPC instance or an I/O optimized instance.
InvalidUserData.SizeExceeded The specified parameter “UserData” exceeds the size. 400 The size of your UserData must be less than 16 KB.
IncorrectInstanceStatus The current status of the resource does not support this operation. 403 You cannot reset the password for an instance when it is in Deleted or Starting status.
InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons. 403 Your instance has been locked.
OperationDenied The current status of the resource does not support this operation. 403 You cannot reset the password for an instance when it is in Deleted or Starting status.
OperationDenied The Specified operation is denied as your instance is locked for security reasons. 403 Your instance has been locked.
HOSTNAME_ILLEGAL hostname is not valid. 404 The specified HostName is invalid.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified InstanceId does not exist.
Thank you! We've received your feedback.