申请弹性公网IP(按需计费)
功能介绍
申请弹性公网IP,支持IPv4和IPv6。
弹性公网IP(Elastic IP)提供独立的公网IP资源,包括公网IP地址与公网出口带宽服务。可以与弹性云服务器、裸金属服务器、虚拟IP、弹性负载均衡、NAT网关等资源灵活地绑定及解绑。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。
URI
POST /v1/{project_id}/publicips
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
bandwidth |
是 |
带宽对象 |
|
enterprise_project_id |
否 |
String |
缺省值:0 最小长度:0 最大长度:36 |
publicip |
是 |
CreatePublicipOption object |
弹性公网IP对象 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
charge_mode |
否 |
String |
缺省值:bandwidth |
id |
否 |
String |
最大长度:36 |
name |
否 |
String |
最小长度:1 最大长度:64 |
share_type |
是 |
String |
|
size |
否 |
Integer |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
ip_address |
否 |
String |
最大长度:15 |
type |
是 |
String |
|
ip_version |
否 |
Integer |
缺省值:4 |
alias |
否 |
String |
最大长度:64 |
port_id |
否 |
String |
最小长度:36 最大长度:36 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
publicip |
PublicipCreateResp object |
弹性公网IP对象 |
参数 |
参数类型 |
描述 |
---|---|---|
bandwidth_size |
Integer |
|
create_time |
String |
|
id |
String |
最大长度:36 |
public_ip_address |
String |
最大长度:15 |
status |
String |
|
tenant_id |
String |
项目ID 最大长度:36 |
type |
String |
最大长度:36 |
public_ipv6_address |
String |
最大长度:39 |
ip_version |
Integer |
|
enterprise_project_id |
String |
最大长度:36 |
alias |
String |
最大长度:64 |
请求示例
-
创建IPv4 弹性公网IP独享带宽。
{ "bandwidth" : { "size" : 10, "share_type" : "PER", "name" : "bandwidth123" }, "publicip" : { "ip_version" : 4, "type" : "5_bgp" } }
-
创建IPv6 弹性公网IP并插入共享带宽,其中id字段为需要插入的共享带宽的id
{ "bandwidth" : { "size" : 5, "share_type" : "WHOLE", "name" : "bandwidth123", "id" : "7f73d14b-cbcf-4363-aa32-602aae9800e0" }, "publicip" : { "ip_version" : 6, "type" : "5_bgp" } }
响应示例
状态码:200
POST操作正常返回
{ "publicip" : { "tenant_id" : "8b7e35ad379141fc9df3e178bd64f55c", "bandwidth_size" : 0, "public_ip_address" : "161.xx.xx.7", "ip_version" : 4, "create_time" : "2015-07-16 04:10:52", "id" : "f588ccfa-8750-4d7c-bf5d-2ede24414706", "type" : "5_bgp", "status" : "PENDING_CREATE" } }
状态码
状态码 |
描述 |
---|---|
200 |
POST操作正常返回 |
错误码
请参见错误码。