All Products
Search
Document Center

Elastic Compute Service:ConvertNatPublicIpToEip

Last Updated:Aug 12, 2026

Converts the public IP address (PublicIP) of a VPC-type ECS instance to an Elastic IP Address (EIP).

Operation description

Operation description

After a public IP address is converted to an EIP, the EIP is billed separately. Make sure that you fully understand the billable methods of EIPs.

When you invoke this operation, the ECS instance must meet the following conditions:

  • The instance is in the Stopped (Stopped) or Running (Running) state.

  • No EIP is attached to the instance.

  • The instance has no pending configuration change nodes.

  • The public bandwidth cannot be 0 Mbit/s.

  • For subscription instances, the billing method for public bandwidth must be pay-by-traffic. Public IP addresses with the pay-by-bandwidth billing method cannot be converted to EIPs. Pay-as-you-go instances are not subject to this restriction. For more information, refer to Transform the billing method for network usage.

  • The VPC-type subscription ECS instance does not expire within 24 hours.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ConvertNatPublicIpToEip

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID of the instance whose public IP address you want to convert.

i-bp171jr36ge2ulvk****

RegionId

string

Yes

The region ID of the instance. You can call DescribeRegions to query the most recent region list.

cn-hangzhou

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 OperationDenied.CloudboxNotSupport This operation is denied, because the specified ECS instance which is in the Cloudbox dose not support PublicIp or Eip.
400 InvalidParameter.CloudboxNotSupported %s
400 OperationDenied.DedicatedRegionNotSupported This operation is denied, because the specified ECS instance which is in the dedicated region dose not support PublicIp or Eip. error of api not supported by the exclusive cloud
400 AccountInArrears The account is in arrears. Your account has overdue payments.
403 InvalidInstanceId.PlanedChange %s Your operation is invalid because a configuration change has been scheduled for the specified instance.
403 InvalidEndTime.OperateNotSupport %s The instance is in a state that does not support the current operation.
403 InvalidInstanceStatus.Released %s The operation is invalid. Check the state of the instance.
403 IncorrectInstanceStatus %s The instance is in a state that does not support the current operation.
403 OperationDenied %s
403 InvalidInstance.ZeroBandwidth %s
403 InvalidInternetChargeType.ValueNotSupported %s
403 InvalidInstanceId.NotFound %s The specified instance does not exist. Check whether the InstanceId parameter is valid.
403 MaxEIPQuotaExceeded The number of EIP exceeds the limit per region. The maximum number of EIPs in the current region has been reached.
403 Forbidden.InvalidPublicBandwidth The specified instance public bandwidth is less than 1M. The specified public bandwidth value of the instance is invalid.
403 InvalidInstance.OverduePayment The special instance due to overdue payment,this operation is not supported. Your account has overdue payments. Add funds to your account and try again.
403 EIPMaxBandwidthExceeded The bandwidth of instance exceeds the limitation of EIP in this region.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 Forbidden.RiskControl This operation is forbidden by Aliyun RiskControl system. The operation is forbidden by the risk control system.
403 UnsupportedPublicIpWithIsp %s
404 InvalidInstanceId.NotFound %s
404 InvalidInstance.IpAddressMissing %s The specified instance does not have a public IP address. For more information, refer to the actual return result of the %s placeholder in the error message. You can call DescribeInstances to query the status of the specified instance.
409 OperationConflict Request was denied due to conflict with a previous request,please try again later. The requested resource conflicts with a previous request.
409 TokenProcessing The previous token request is still processing. Please try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.