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
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ens:ModifyInstanceAttribute | update | *Instance acs:ens:*:{#accountId}:instance/{#InstanceId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The ID of the instance for which you want to modify attributes. You can specify only one ID. | i-instanc**** |
Password | string | No | The password of the instance. | yourPassword |
InstanceName | string | No | 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 | i-instanceidname |
HostName | string | No | 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 |
UserData | string | No | 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
Examples
Sample success responses
JSON
format
{
"Code": 200,
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | MissingParameter | The input parameter that is mandatory for processing this request is not supplied. |
400 | InstanceIdNotFound | The input parameter InstanceId that is not found. |
400 | InvalidParameter.%s | The specified field %s invalid. Please check it again. |
400 | NoPermission | Permission denied. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|