All Products
Search
Document Center

ENS:ModifyInstanceAttribute

Last Updated:Nov 18, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ens:ModifyInstanceAttributeupdate
*Instance
acs:ens:*:{#accountId}:instance/{#InstanceId}
    none
none

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