All Products
Search
Document Center

ENS:ModifyInstanceAttribute

Last Updated:Apr 16, 2024

Changes the attributes of an instance, such as the name and the password.

Operation description

  • If an instance is in the Starting state, you cannot reset the password of the instance.
  • When the instance is in the Running state, you cannot change the password of the instance.
  • After resetting the password, you must Restart the instance in the ECS console or call the RebootInstance operation to validate the modifications. The restart operation within the instance does not validate the modifications.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance for which you want to modify attributes. You can specify only one ID.

i-instanc****
PasswordstringNo

The password of the instance.

yourPassword
InstanceNamestringNo

The name of the instance.

The name must be 2 to 128 characters in length. It must start with a letter but cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), and hyphens (-).

i-instanceidname
HostNamestringNo

The hostname of the Elastic Compute Service (ECS) instance. The value can be 2 to 64 characters in length. You can use periods (.) to separate the value into multiple segments. Each segment can contain letters, digits, hyphens (-), and periods. Consecutive periods or hyphens are not allowed. The name cannot start or end with a period (.) or a hyphen (-).

testHostName
UserDatastringNo

The user data of the instance. User data must be encoded in Base64.

The size of your UserData cannot exceed 16 KB. We recommend that you do not pass in confidential information such as passwords and private keys in the plaintext format. If you must pass in confidential information, we recommend that you encrypt and Base64-encode the information before you pass it in. Then you can decode and decrypt the information in the same way within the instance.

/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgK****

Response parameters

ParameterTypeDescriptionExample
object
Codeinteger

The returned service code. 0 indicates that the request was successful.

200
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "Code": 200,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError message
400MissingParameterThe input parameter that is mandatory for processing this request is not supplied.
400InstanceIdNotFoundThe input parameter InstanceId that is not found.
400InvalidParameter.%sThe specified field %s invalid. Please check it again.
400NoPermissionPermission denied.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history