You can call this operation to convert the public IP address of a VPC-type instance to an Elastic IP Address (EIP).

Description

After a public IP address is converted to an EIP, the EIP will be billed separately. Make sure that you have fully understood the billing methods of EIPs. For more information, see Billing overview.

Before you call this operation, make sure that the following requirements are met:

  • The instance must be in the Stopped (Stopped) or Running (Running) state.
  • The instance has no EIPs associated.
  • The instance has no configuration change tasks that have not taken effect.
  • The public bandwidth of the instance cannot be 0 Mbit/s.
  • The public bandwidth of the instance is billed on a pay-by-traffic basis.
  • If the instance is a VPC-type subscription instance, it will not expire within 24 hours.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
InstanceId String Yes i-bp1ecr********5go2go

The ID of the instance for which you want to convert its public IP address to an EIP.

RegionId String Yes cn-hangzhou

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

Action String No ConvertNatPublicIpToEip

The operation that you want to perform. Set the value to ConvertNatPublicIpToEip.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ConvertNatPublicIpToEip
&RegionId=cn-hangzhou
&InstanceId=i-bp1ecr********5go2go
&<Common request parameters>

Sample success responses

XML format

<ConvertNatPublicIpToEipResponse>
      <RequestId>B154D309-F3E1-4AB7-BA94-FEFCA8B89001</RequestId>
</ConvertNatPublicIpToEipResponse>

JSON format

{
	"RequestId":"B154D309-F3E1-4AB7-BA94-FEFCA8B89001"
}

Error codes

HTTP status code Error code Error message Description
403 InvalidInstanceId.PlanedChange %s The error message returned because the instance has configuration change tasks that have not taken effect.
403 InvalidEndTime.OperateNotSupport %s The error message returned because this operation is not supported while the instance is in the current state.
403 InvalidInstanceStatus.Released %s The error message returned because the specified instance status is invalid.
403 IncorrectInstanceStatus %s The error message returned because the operation is not supported while the instance is in the current state.
403 OperationDenied %s The error message returned because the operation is denied.
404 InvalidInstanceId.NotFound %s The error message returned because the specified InstanceId parameter does not exist.
403 InvalidInternetChargeType.ValueNotSupported %s The error message returned because the specified InternetChargeType parameter is invalid.
403 MaxEIPQuotaExceeded The number of EIP exceeds the limit per region. The error message returned because the maximum number of EIPs in the current region has been reached.
403 InvalidInstance.OverduePayment %s The error message returned because your account has an overdue payment. You must top up your account before proceeding.

For a list of error codes, visit the API Error Center.