技术员联盟提供win764位系统下载,win10,win7,xp,装机纯净版,64位旗舰版,绿色软件,免费软件下载基地!

当前位置:主页 > 教程 > 服务器类 >

阿里云如何使用网络相关接口

来源:技术员联盟┆发布时间:2017-12-01 00:44┆点击:

  分配公网 IP 地址

  描述

  给一个特定实例分配一个可用公网IP地址。

  实例的状态必须为 Running 或 Stopped 状态,才可以调用此接口。

  分配的 IP 必须在实例启动或重启后才能生效。

  分配的时候只能是 IP,不能是 IP 段。

  目前,一个实例只能分配一个 IP。当调用此接口时,如果实例已经拥有一个公网 IP,将直接返回原 IP 地址。

  被安全控制在实例的 OperationLocks 中标记了 "LockReason" : "security" 的锁定状态时,不能分配公网 IP。

  请求参数

名称 类型 是否必须 描述
Action   String     系统规定参数,取值:AllocatePublicIpAddress  
InstanceId   String     需要分配 IP 地址的实例 ID  

  返回参数

名称 类型 描述
IpAddress   String   分配的公网 IP 地址  

  错误码

错误代码 描述 Http 状态码 语义
InvalidInstanceId.NotFound   The InstanceId provided does not exist in our records.   404   指定的 InstanceId 不存在  
MissingParameter   The input parameter "InstanceId" that is mandatory for processing this request is not supplied.   400   缺少 InstanceId 值  
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   该资源目前被安全锁定被拒绝操作  
InstanceExpiredOrInArrears   The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).   403   实例到期或者欠费(是指该实例是包年包月或者按量欠费的情况)  
IpInUse   The specified IP is already in use.   403   用户使用指定 IP 进行绑定时,IP 已经被使用在别的机器上  
AllocatedAlready   There is an IpAddress allocated already for the specified instance.   403   用户使用指定 IP 进行绑定时,该实例已经被分配了别的 IP 地址  

  示例

  请求示例

  https://ecs.aliyuncs.com/?Action=AllocatePublicIpAddress

  &InstanceId=i-instance1

  &<公共请求参数>