技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

阿里云如何使用網(wǎng)絡(luò)相關(guān)接口

來源:技術(shù)員聯(lián)盟┆發(fā)布時間:2017-12-01 00:44┆點擊:

  分配公網(wǎng) IP 地址

  描述

  給一個特定實例分配一個可用公網(wǎng)IP地址。

  實例的狀態(tài)必須為 Running 或 Stopped 狀態(tài),才可以調(diào)用此接口。

  分配的 IP 必須在實例啟動或重啟后才能生效。

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

  目前,一個實例只能分配一個 IP。當(dāng)調(diào)用此接口時,如果實例已經(jīng)擁有一個公網(wǎng) IP,將直接返回原 IP 地址。

  被安全控制在實例的 OperationLocks 中標(biāo)記了 "LockReason" : "security" 的鎖定狀態(tài)時,不能分配公網(wǎng) IP。

  請求參數(shù)

名稱 類型 是否必須 描述
Action   String     系統(tǒng)規(guī)定參數(shù),取值:AllocatePublicIpAddress  
InstanceId   String     需要分配 IP 地址的實例 ID  

  返回參數(shù)

名稱 類型 描述
IpAddress   String   分配的公網(wǎng) IP 地址  

  錯誤碼

錯誤代碼 描述 Http 狀態(tài)碼 語義
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   該資源目前的狀態(tài)不支持此操作  
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 進(jìn)行綁定時,IP 已經(jīng)被使用在別的機器上  
AllocatedAlready   There is an IpAddress allocated already for the specified instance.   403   用戶使用指定 IP 進(jìn)行綁定時,該實例已經(jīng)被分配了別的 IP 地址  

  示例

  請求示例

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

  &InstanceId=i-instance1

  &<公共請求參數(shù)>