This API modifies attributes of an ECS instance, such as the password, instance name, hostname, security group, MTU, and user data.
Operation description
This API call is not supported for instances protected by a resource security lock. For more information, see How resource security locks affect API calls.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ModifyInstanceAttribute |
update |
*Instance
SecurityGroup
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the instance. |
i-bp67acfmxazb4ph**** |
| Password |
string |
No |
The password of the instance. The password must be 8 to 30 characters long and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are ()~!@#$%^&*-_+=|{}[]:;'<>,.?/. For a Windows instance, the password cannot start with a forward slash (/). Note the following when you use this parameter:
Note
To prevent password exposure, send requests that include the |
Test123456&$ |
| HostName |
string |
No |
The hostname of the operating system. Note the following when you use this parameter:
The hostname must meet the following requirements for different operating systems:
|
testHostName |
| InstanceName |
string |
No |
The instance name. The name must be 2 to 128 characters long. It must start with a letter or a Chinese character and cannot start with |
testInstanceName |
| Description |
string |
No |
The instance description. The description must be 2 to 256 characters long and cannot start with |
testInstanceDescription |
| UserData |
string |
No |
The user data of the instance. User data should be Base64-encoded before it is passed. Note the following when you use this parameter:
Note
The raw data cannot exceed 32 KB before being encoded. Do not pass confidential information, such as passwords and private keys, in plaintext. If you must pass confidential information, encrypt and then Base64-encode it. On the instance, decrypt the information by using the corresponding decryption method. |
ZWNobyBoZWxsbyBlY3Mh |
| Recyclable |
boolean |
No |
Note
This parameter is in invitation-only preview and is not publicly available. |
true |
| CreditSpecification |
string |
No |
The performance mode of the burstable performance instance. Valid values:
For more information about the performance modes of burstable performance instances, see Overview of burstable performance instances. |
Standard |
| DeletionProtection |
boolean |
No |
Specifies whether to enable deletion protection for the instance. This setting prevents the instance from being released from the console or by calling the DeleteInstance operation. Note
This feature applies only to pay-as-you-go instances and protects instances only from manual release operations. It does not affect system-initiated release operations. |
false |
| NetworkInterfaceQueueNumber |
integer |
No |
The number of queues for the primary network interface. Note the following when you use this parameter:
|
8 |
| SecurityGroupIds |
array |
No |
The IDs of security groups to assign to the instance. Note the following when you use this parameter:
Note
The change takes effect on the instance after a short delay. |
sg-bp15ed6xe1yxeycg7o**** |
|
string |
No |
The ID of the security group. |
sg-bp15ed6xe1yxeycg7o**** |
|
| RemoteConnectionOptions |
object |
No |
Note
This parameter is in invitation-only preview and is not publicly available. |
|
| Password |
string |
No |
Note
This parameter is in invitation-only preview and is not publicly available. |
hide |
| Type |
string |
No |
Note
This parameter is in invitation-only preview and is not publicly available. |
hide |
| EnableJumboFrame |
boolean |
No |
Specifies whether to enable jumbo frames. When jumbo frames are enabled, the MTU of the instance is 8500. When jumbo frames are disabled, the MTU of the instance is 1500. Valid values:
Note the following when you use this parameter:
|
false |
| CpuOptions.Core |
integer |
No |
The number of CPU cores. This parameter is not customizable and uses a default value. |
2 |
| CpuOptions.ThreadsPerCore |
integer |
No |
The number of threads per core. The total number of vCPUs for an ECS instance is the value of
|
2 |
| CpuOptions.TopologyType |
string |
No |
The CPU topology type of the instance. Valid values:
Default value: None. Note the following when you use this parameter:
Note
This parameter is supported by only some instance families. See View and modify the CPU topology for a list of supported families. |
DiscreteCoreToHTMapping |
| PrivateDnsNameOptions |
object |
No |
The private DNS name settings for the instance. For more information about private DNS name resolution, see ECS private DNS resolution . |
|
| EnableInstanceIdDnsARecord |
boolean |
No |
Specifies whether to enable resolution of the instance ID-based domain name to an IPv4 address. Valid values:
Default value: false. |
false |
| EnableInstanceIdDnsAAAARecord |
boolean |
No |
Specifies whether to enable resolution of the instance ID-based domain name to an IPv6 address. Valid values:
Default value: false. |
false |
| EnableIpDnsARecord |
boolean |
No |
Specifies whether to enable resolution of the IP address-based domain name to an IPv4 address. Valid values:
Default value: false. |
false |
| EnableIpDnsPtrRecord |
boolean |
No |
Specifies whether to enable reverse DNS resolution of an IPv4 address to an IP address-based domain name. Valid values:
Default value: false. |
false |
| HostnameType |
string |
No |
The hostname type. Valid values:
Default value: Custom. |
Custom |
| CpuOptions |
object |
No |
||
| NestedVirtualization |
string |
No |
Note
This parameter is in invitation-only preview and is not publicly available. |
enabled |
| EnableNetworkEncryption |
boolean |
No |
Specifies whether to enable VPC network traffic encryption. Valid values:
Note
This parameter is in invitation-only preview and is not publicly available. |
true |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidInstanceName.Malformed | The specified parameter "InstanceName" is not valid. | The specified InstanceName parameter is invalid. |
| 400 | InvalidDescription.Malformed | The specified parameter "Description" is not valid. | The source description can be 2 to 256 characters in length. It cannot start with http:// and https://. |
| 400 | InvalidRemoteConnectionOptions.Password | The remote connection password is invalid. | |
| 400 | InvalidRemoteConnectionOptions.Type | The remote connection type is invalid. | |
| 400 | InstanceType.ValueNotSupported | The instance type not supported. | |
| 400 | OSType.ValueNotSupported | The OS type is not supported. | |
| 400 | InvalidHostPassword.Malformed | The specified parameter "Password" is not valid. | |
| 400 | InvalidHostName.Malformed | The specified parameter "HostName" is not valid. | |
| 400 | InvalidPassword.Malformed | The specified parameter "Password" is not valid. | |
| 400 | InvalidUserData.SizeExceeded | The specified parameter "UserData" exceeds the size. | |
| 400 | InvalidUserData.NotSupported | TThe specified parameter "UserData" only support the vpc and IoOptimized Instance. | |
| 400 | ImageNotSupportCloudInit | The specified image does not support cloud-init. | |
| 400 | ChargeTypeViolation | Pay-As-You-Go instances do not support this operation. | |
| 400 | InvalidParameter.RecycleBin | You do not have permission to set recyclable properties. | You are not authorized to perform the operation. |
| 400 | InvalidParameter.CreditSpecification | The specified CreditSpecification is not supported in this region. | The running mode of the specified burst performance instance is not supported in this zone. |
| 400 | InvalidInstanceStatus.CreditSpecRestricted | The current status of the resource does not support this operation. | The resource is in a state that does not support the current operation. |
| 400 | InvalidInstanceStatus.NotRunning | The current status of the resource is invalid, you can only do this operation when instance is running. | The resource is in a state that does not support the operation. Perform the operation when the instance is in the Running state. |
| 400 | InvalidNetworkType.NotSupported | The classic networkType does not support to modify security group | |
| 400 | InvalidOperation.EniCountExceeded | =The maximum number of eni in a enterprise security group is exceeded. | |
| 400 | JoinedGroupLimitExceed | %s | The maximum number of security groups to which the specified resource can be added has been reached. For more information, see the return value of the %s placeholder in the error message. |
| 400 | InvalidParameter | The specified parameter is not valid. | A specified parameter is invalid. |
| 400 | InvalidOperation.InvalidEcsState | %s | |
| 400 | InvalidParam.NotSupportJumboFrame | Not support jumbo frame. | |
| 400 | InvalidOperation.InstanceStatusNotSupport | The instance status is not support modify mtu config. | |
| 400 | InvalidOperation.InstanceStatusUnsupported | The specified instance status does not support modification of cpu topology type. | The specified instance status does not support modification of cpu topology type. |
| 400 | InvalidParameter.CpuOptionsTopologyType | The specified parameter CpuOptions.TopologyType: %s is not valid. | Illegal enumeration value for current CPU topology type |
| 400 | InvalidInstanceType.NotSupportCpuOptionsTopologyType | The specified instance type does not support CpuOptions.TopologyType: %s. | The current specification does not support the specified CPU topology type |
| 400 | InvalidAdditionalInfoPvdConfig.SizeExceeded | The specified parameter AdditionalInfo.PvdConfig exceeds the size. | |
| 400 | InvalidInstanceType.NotSupportHighDensityMode | The specified instance type does not support the use of the high density mode. | The current instance type does not support the cloud disk high-density mode. |
| 400 | InvalidStatus.StoppedRequired | The current state of the resource does not support this operation, it can only be operated in a stopped state. | The current state of the resource does not support this operation, only down state can operate |
| 400 | InvalidParameter.CpuOptionsTurboMode | The specified parameter TurboMode is not valid. | The specified parameter frequency mode is invalid |
| 400 | InvalidInstanceType.EnableNVSUnsupported | The specified instance type does not support EnableNVS. | |
| 400 | InvalidInstanceType.EnableVISSTUnsupported | The specified instance type does not support EnableVISST. | |
| 400 | InvalidInstanceType.EnableVRDTUnsupported | The specified instance type does not support EnableVRDT. | |
| 400 | InvalidInstanceType.SingleCoreMaxModeUnsupported | The specified instance type does not support TurboMode: "SINGLE CORE MAX". | The specified instance type does not support single-core maximum turbo mode |
| 400 | InvalidInstanceType.GpuOptionsConfidentialComputingUnsupported | The specified instance type does not support the confidential computing mode. | the current instance type does not support encrypted computing mode. |
| 400 | InvalidParameter.GpuOptionsConfidentialComputing | The specified parameter confidential computing mode is not valid. | The enum value of the GPU encryption computing mode of the current instance is invalid. |
| 400 | InvalidParameterAuthorized.GpuOptionsConfidentialComputing | The specified parameter confidential computing mode is unauthorized. | |
| 400 | InvalidParameter.CpuOptionsNestedVirtualization | The specified parameter CpuOptions.NestedVirtualization: %s is not valid. | |
| 400 | InvalidInstanceType.NotSupportCpuOptionsNestedVirtualization | The specified instance type does not support CpuOptions.NestedVirtualization: %s. | The specified instance type does not support CpuOptions.NestedVirtualization value. |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | |
| 403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | |
| 403 | OperationDenied | The instance amount in the specified SecurityGroup reach its limit. | The maximum number of instances in the specified security group has been reached. |
| 403 | InvalidUserData.Forbidden | User not authorized to input the parameter "UserData"please apply for permission "UserData" | |
| 403 | InvalidUserData.Base64FormatInvalid | The specified UserData is not valid | An error occurred when the specified UserData parameter is encoded. |
| 403 | InvalidChargeType.ValueNotSupported | Deletion protection is only valid for postPaid instance, not for prePaid or spot instance. | Release protection can be enabled only for pay-as-you-go instances. |
| 403 | InvalidUser.Unauthorized | The user is not authorized | You are not authorized to perform this operation. |
| 403 | EnterpriseGroupLimited.MutliGroupType | The specified instance can not join multi SecurityGroup types. | The specified instance cannot belong to both a basic and an advanced security group. You can call the DescribeSecurityGroups operation to query the type of security groups. |
| 403 | SecurityGroupInstanceLimitExceed | %s | |
| 403 | InstanceNotInSecurityGroup | The instance not in the group. | |
| 403 | InvalidOperation.InvalidRegion | %s | |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | %s | You cannot modify security groups managed by cloud services. |
| 403 | InvalidParameter.InvalidEniQueueNumber | %s | |
| 403 | InvalidOperation.MaxEniQueueNumberExceeded | %s | |
| 403 | InvalidOperation.ExceedInstanceTypeQueueNumber | %s | The maximum number of queues for all ENIs on an instance has been exceeded. For more information, see the return value of the %s placeholder in the error message. |
| 403 | InvalidOperation.InstanceTypeNotSupportHighPerformanceTrafficMode | %s | The instance type of the specified instance does not support the NIC of the RDMA communication mode. |
| 403 | InvalidParameter.InvalidQueuePairNumber | %s | |
| 403 | InvalidOperation.MaxEniQueuePairNumberExceed | %s | |
| 403 | InvalidOperation.EniQueuePairNumberOverflow | %s | |
| 403 | AclLimitExceed | %s | The number of ACL rules for an ENI or instance exceeds the upper limit. |
| 403 | InvalidInstanceType.CpuOptionsThreadsPerCoreUnsupported | The current instance type does not support setting or modifying the CpuOptions.ThreadsPerCore parameter. | The current instance type does not support setting or modifying the CpuOptions.ThreadsPerCore parameter. |
| 403 | InvalidParameter.CpuOptionsCore | The specified parameter CpuOptions.Core is not valid. | The specified parameter CpuOptions.Core is not valid. |
| 403 | InvalidParameter.CpuOptionsThreadsPerCore | The specified parameter CpuOptions.ThreadsPerCore is not valid. | The specified parameter CpuOptions.ThreadsPerCore is not valid. |
| 403 | InvalidOperation.UserNotSupportNetworkEncryption | User not support network encryption. | The user does not support specifying network traffic encryption parameters. |
| 403 | InvalidOperation.InstanceTypeNotSupportNetworkEncryption | The specified instance type does not support network encryption. | the specified instance type does not support vpc traffic encryption |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | The specified instanceId is invalid. |
| 404 | InvalidSecurityGroupId.NotFound | The specified SecurityGroupId does not exist. | The specified security group does not exist in this account. Check whether the security group ID is correct. |
| 404 | Credit.NotFound | The specified credit information does not exist. | The specified burst performance instance credit information does not exist. |
| 404 | InvalidInstanceStatus.NeedRestart | The current status of the resource is invalid, you can only do this operation after instance is restarted. | |
| 404 | InvalidParameter.SecurityGroupIdRepeated | The specified security group ids has repeated. | Duplicate security group IDs are specified. Check whether the specified SecurityGroupIds.N parameter is valid. |
| 404 | InvalidSecurityGroupType.NotSupportClassic | The specified SecurityGroupIds have classic group type. | The specified security group is in the classic network. Check whether the specified SecurityGroupIds.N parameter is valid. |
| 404 | InvalidSecurityGroupVpc.NotBelongToOneVpc | The specified SecurityGroupIds are belong to different vpc. | The specified security groups belong to different VPCs. Check whether the specified SecurityGroupIds.N parameter is valid. You can call the DescribeSecurityGroups operation to query the VPCs to which the security groups belong. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.