CreateEips

CreateEips

1. API Description

This API is used to create one or more elastic IPs.

Prerequisites

Note

  • eipV4Type and cidrId cannot be passed together or left empty.

  • Passing cidrId means the public IP is generated from a CIDR block.

  • If assigning to an instance, ensure that the primary private IP on the instance’s primary vNIC can still be assigned an elastic IP.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

regionId

Yes

String

Region ID.

amount

No

Integer

Quantity.

name

Yes

String

Name of the elastic IP. This parameter must start with a number or a letter, containing 2 to 63 characters. Only letters, numbers, - and periods (.) are supported.

internetChargeType

Yes

String

eipV4Type

Yes

String

primaryIsp

No

String

If the eipV4Type field is set to ThreeLine, this field is required and must include:

  • CHINA_TELECOM

  • CHINA_UNICOM

  • CHINA_MOBILE

bandwidth

No

Integer

Public outbound bandwidth cap.

Unit: Mbps.

Bandwidth cap varies by instance size.

flowPackage

No

Float

Traffic package size (TB).

The parameter is valid only when internetChargeType is ByTrafficPackage.

Default value: 0. The value supports up to one decimal place.

cidrId

No

String

CIDR ID. If this parameter is specified, eipV4Type must be empty.

publicIp

No

String

The starting public IP.

resourceGroupId

No

String

Resource group.

clusterld

No

String

Bandwidth cluster ID.

If the value of internetChargeType is Bandwidth, clusterld is required.

peerRegionId

No

String

Remote region ID.

marketingOptions

No

Information on marketing campaigns.

tags

No

Bound tags when creating the image.

Tag keys must be unique.

instanceIds

No

Array of String

IDs of instances to be attached. The number of IDs should be the same as diskAmount.

bindType

No

Elastic IP mode when binding to resources. Effective when specific instanceIds are specified. Defaults to standard NAT mode.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

eipIds

Array of String

ID list of elastic IPs.

orderNumber

String

Order No.

4. Code Example

Create one or more elastic IPs.

POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateEips
<Common Request Params>

Request:
{
  "regionId": "asia-east-1",
  "amount": 1,
  "name": "xxx",
  "internetChargeType": "ByTrafficPackage",
  "eipV4Type": "BGPLine",
  "bandwidth": 50,
  "flowPackage": 2,
  "resourceGroupId": "xxxx"
}

Response:
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "eipIds": ["xxx","xxx"],
    "orderNumber": "xxx"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error Code
Description

404

INVALID_CIDR_NOT_FOUND

CIDR block not found.

400

INVALID_PARAMETER_BANDWIDTH_ERROR

Bandwidth size is below the minimum limit.

400

INVALID_PARAMETER_BANDWIDTH_EXCEED

Bandwidth size exceeds the maximum limit.

404

INVALID_REGION_NOT_FOUND

Specified availability zone does not exist.

400

OPERATION_DENIED_CIDR_IP_INSUFFICIENT

Insufficient remaining IPs in the CIDR block.

400

OPERATION_DENIED_CIDR_STATUS

The specified CIDR state does not support this operation.

400

OPERATION_DENIED_EIP_UNSUPPORT_CUSTOMIZE

Manually specified IP address is invalid.

400

OPERATION_DENIED_EIP_UNSUPPORT_NETWORK_TYPE

EIP network billing type is not supported.

400

OPERATION_DENIED_EIP_UNSUPPORT_REMOTE_IPT

Customer currently does not support configuring Remote IPT.

403

OPERATION_DENIED_INTERNET_CHARGE_TYPE_NOT_SUPPORT

IP network billing type is not supported.

400

OPERATION_DENIED_EIP_NOT_SUPPORT_PASS_THROUGH_BIND_TYPE

Elastic IP mode does not support high-speed mode.

400

INVALID_REGION_MISMATCH

Region mismatch.

403

OPERATION_DENIED_EIP_INSTANCE_NOT_ADAPTER

Specified instance count does not match the number of elastic IPs to be created.

404

INVALID_INSTANCE_NOT_FOUND

Instance not found.

400

INVALID_NIC_STATUS

Current vNIC state does not allow this operation.

400

OPERATION_DENIED_LAN_EIP_TYPE_CONFLICTS

Public IPv4 type conflict on the private IP.

400

OPERATION_DENIED_EIP_ASSIGNED_LIMIT_EXCEEDED

Elastic IP binding exceeds the allowed limit.

Last updated