欢迎来到山村网

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

2019-03-09 10:11:00浏览:667 来源:山村网   
核心摘要:  分配公网 IP 地址  描述  给一个特定实例分配一个可用公网IP地址。  实例的状态必须为 Running 或 Stopped 状态,才可

  分配公网 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

  &<公共请求参数>

  返回示例

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

  修改实例网络规格

  描述

  修改实例的带宽配置。当实例现有网络规格不满足要求时,可以通过此接口修改实例的网络规格来提高网络性能。修改后可能影响到实例所产生的账单费用。

  操作只修改显式给定的参数,没有给定的参数将不会被修改。

  只有实例状态为 Stopped 或 Running 时才可以修改实例的入出公网最大带宽。

  被安全控制在实例的 OperationLocks 中标记了 "LockReason" : "security" 的锁定状态时,不能修改实例网络规格。

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:ModifyInstanceNetworkSpec InstanceId String 是 指定的需要实例规格的实例 ID InternetMaxBandwidthOut Integer 否 公网出网带宽最大值,单位为 Mbps。按带宽计费:0 ~ 100
按流量计费:1 ~ 100
默认值:无,保持原来的带宽 InternetMaxBandwidthIn Integer 否 公网入网带宽最大值,单位为 Mbps。按带宽计费:1 ~ 200
按流量计费:1 ~ 200
默认值:无,保持原来的带宽

  返回参数

  全是公共返回参数,详见公共返回参数

  错误码

错误代码 描述 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 值 InvalidParameter The specified parameter "InternetMaxBandwidthIn" is not valid. 400 指定的 InternetMaxBandwidthIn 不合法(不是数字) InvalidInternetMaxBandwidthIn.ValueNotSupported The specified InternetMaxBandwidthIn beyond the permitted range. 400 指定的 InternetMaxBandwidthIn 不合法(超出范围) InvalidParameter The specified parameter "InternetMaxBandwidthOut" is not valid. 400 指定的 InternetMaxBandwidthOut 不合法(不是数字) InvalidInternetMaxBandwidthOut.ValueNotSupported The specified InternetMaxBandwidthOut beyond the permitted range. 400 指定的 InternetMaxBandwidthOut 不合法(超出范围) 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 实例欠费或过期,拒绝操作 InternalError The request processing has failed due to some unknown error. 500 内部错误 ChargeTypeViolation The operation is not permitted due to charge type of the instance. 403 付费方式不支持这个操作

  示例

  请求示例

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

  &InstanceId=i-23nn22421

  &InternetMaxBandwidthOut=20

  &<公共请求参数>

  返回示例

2.png

  申请弹性公网 IP

  描述

  申请 EIP,新申请的 EIP 状态为 Available。

  EIP 目前只能绑定到相同地域的 VPC 类型的 ECS 实例。

  每次申请会在指定的 Region 内随机分配一个 EIP。

  EIP 目前只支持 ICMP,TCP,UDP 3 种协议,不支持 IGMP,SCTP 等传输层协议。

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:AllocateEipAddress RegionId String 是 申请的弹性公网 IP 所在的地域 Bandwidth String 否 弹性公网 IP 的限速,如果不指定,默认为 5Mbps。 InternetChargeType String 否 PayByBandwidth 和 PayByTraffic,默认是 PayByBandwidth ClientToken String 否 用于保证请求的幂等性。由客户端生成该参数值,要保证在不同请求间唯一,最大不值过 64 个 ASCII 字符。
具体参见附录

  返回参数

名称 类型 描述 EipAddress String 分配的弹性公网 IP AllocationId String 弹性公网 IP 的实例 Id

  错误码

错误代码 描述 Http 状态码 语义 Forbbiden User not authorized to operate on the specified resource. 403 用户没有使用 EIP 产品的权限,请提交工单申请 QuotaExceeded.Eip Elastic IP address quota exceeded. 400 EIP 的个数超过额度限制 InvalidRegionId.NotFound Specified value of “RegionId” is not supported. 404 指定的 RegionId 不存在 InvalidParameter Specified value of “InternetChargeType” is not valid 400 指定的 InternetChargeType 参数不合法 InvalidParameter Specified value of “Bandwidth” is not valid. 400 指定的 Bandwidth 参数不合法 InsufficientEipCapacity Insufficient EIP capacity to fulfill your request. 500 指定 Region 的 EIP 库存不足 InsufficientBalance Your account does not have enough balance. 400 账户余额不足,无法申请 EIP

  示例

  请求示例

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

  &RegionId=cn-beijing

  &<公共请求参数>

  返回示例

3.png

  绑定弹性公网IP

  描述

  将EIP绑定到相同地域的云服务实例或HaVip实例上

  目前EIP只支持绑定到ECS实例和HaVip实例上

  只有Available状态的EIP才能够进行绑定操作

  EIP绑定成功后立刻生效,不需要重启云服务器实例

  EIP目前只能被绑定到相同地域的专有网络类型云服务器实例上

  每个云服务器实例或HaVip实例只能同时绑定一个EIP

  每个EIP同一时间只能绑定一个云产品实例

  只有处于运行中和已停止状态的云服务器实例可以绑定弹性公网IP

  只有处于Available或者InUse状态的HaVip可以绑定弹性公网IP

  因为安全原因被锁定的EIP无法进行绑定和解绑操作

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:AssociateEipAddress AllocationId String 是 需要进行绑定操作的EIP的申请Id,申请Id是EIP的唯一标识 InstanceType String 否 绑定的对象类型。
取值范围:EcsInstance | HaVip
默认值:EcsInstance InstanceId String 是 需要进行绑定操作的实例id。
若InstanceType为EcsInstance,则此处填写ECS实例Id;若InstanceType为HaVip,则此处填写HaVipId;

  返回参数

  全是公共返回参数,详见公共返回参数

  错误码

错误代码 描述 Http 状态码 语义 InvalidAssociation.Duplicated Specified instance already is associated. 400 指定的ECS实例已绑定EIP,不能再绑定。 OperationDenied Specified instance is not in VPC. 400 指定的ECS实例不是VPC类型实例,绑定失败。 InvalidParameter.Mismatch Specified elastic IP address and ECS instance are not in the same region. 400 指定ECS实例和EIP不属于同一个region IncorrectEipStatus Current elastic IP status does not support this operation. 400 指定的EIP状态不支持此操作 InvalidAllocationId.NotFound Specified allocation ID is not found. 404 指定的EIP的申请ID不存在,绑定失败 InvalidInstanId.NotFound Specified instance does not exist. 404 指定的ECS实例不存在,绑定失败 IncorrectInstanceStatus Current instance status does not support this operation. 400 指定的ECS实例状态为非stop和running,绑定EIP失败 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported. 400 InstanceType的输入值不合法 InvalidHaVip.NotFound The specified HaVip does not exist. 404 InstanceType为HaVip,且InstanceId并不是一个真实存在的有效HaVipId。 CountLimitExceeded.EIPonECSInstance One ECS Instance can be associated with only one EIP. 400 ECS实例上允许绑定的EIP数量已经达到上限 CountLimitExceed.EIPonHaVip One HaVip can be associated with only one EIP. 400 HaVip上允许绑定的EIP数量已经达到上限 IncorrectHaVipStatus HaVip can be operated by this action only when it’s status is Available or InUse. 400 HaVip状态不符合要求

  示例

  请求示例

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

  &AllocationId=eip-25877c70x

  &InstanceId=i-25skktcp4

  &<公共请求参数>

  返回示例

4.png

  查询弹性公网IP列表

  描述

  查询指定地域的EIP列表。此接口支持分页查询,每页的数量默认为10条。

  此接口不会校验参数之间的依赖关系,返回结果是所有条件的“交集”。

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:DescribeEipAddresses RegionId String 是 需要查询的地域 Status String 否 Eip状态,包括Associating | Unassociating | InUse | Available EipAddress String 否 EIP AllocationId String 否 申请Id AssociatedInstanceType String 否 绑定的资源的类型;
这是一个过滤器性质的参数,若不指定,则表示不使用该条件对结果进行过滤。
取值范围:EcsInstance|HaVip AssociatedInstanceId String 否 绑定的资源的Id。
这是一个过滤器性质的参数,若不指定,则表示不适用该条件对结果进行过滤。
如果要使用该过滤器,必须同时使用AssociatedInstanceType。
如果AssociatedInstanceType是HaVipId,则该参数填写HaVipId;若AssociatedInstanceType是EcsInstance,则该参数填写EcsInstancdId。 PageNumber Integer 否 实例状态列表的页码,起始值为1,默认值为1 PageSize Integer 否 分页查询时设置的每页行数,最大值50行,默认为10

  返回参数

名称 类型 描述 EipAddresses EipAddressSetType 弹性IP地址详情EipAddressSetType组成的集合 TotalCount Integer 列表条条目数 PageNumber Integer 当前页码 PageSize Integer 当前分页包含多少条目

  错误码

错误代码 描述 Http 状态码 语义 Forbidden.RegionNotFound Specified region is not found during access authentication. 404 指定的region不存在 InvalidIAssociatedInstanceType.ValueNotSupported The specified value of AssociatedInstanceType is not supported. 400 AssociatedInstanceType的输入值不合法。

  示例

  请求示例

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

  &RegionId=cn-hangzhou-1

  &<公共请求参数>

  返回示例

5.png

  JSON格式

  {

  "EipAddresses": {

  "EipAddress": [

  {

  "AllocationId": "eip-2578g5v5a",

  "AllocationTime": "2014-05-28T03:03:16Z ",

  "Bandwidth": "1",

  "InstanceId": "",

  "InternetChargeType": " PayByBandwidth ",

  "IpAddress": "123.56.0.36",

  "OperationLocks": {

  "LockReason": []

  },

  "RegionId": "cn-beijing",

  "Status": "Available"

  }

  ]

  },

  "PageNumber": 1,

  "PageSize": 10,

  "RequestId": "51BE7822-4121-428A-88F3-262AE4FD868D",

  "TotalCount": 1

  }

  修改弹性公网 IP 属性

  描述

  修改指定EIP的属性,目前主要用于修改EIP的带宽限速

  EIP的带宽限速可以无限次修改,新配置即时生效。

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:ModifyEipAddressAttribute AllocationId String 是 申请 Id Bandwidth String 是 修改后的弹性 IP 地址带宽,带宽以 Mbps 计算。

  返回参数

  全是公共返回参数,详见公共返回参数

  错误码

错误代码 描述 Http 状态码 语义 InvalidParameter Specified value of “Bandwidth” is not supported. 400 指定带宽值不合法 InsufficientBalance Your account does not have enough balance. 400 账号已欠费,修改 EIP 的带宽操作失败。 InvalidAllocationId.NotFound Specified allocation ID is not found。 404 指定的 EIP 的申请 Id 不存在。

  示例

  请求示例

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

  &AllocationId=eip-25877c70x

  &Bandwidth=1

  &<公共请求参数>

  返回示例

6.png

  解绑弹性公网IP

  描述

  解除一个EIP的绑定状态。

  若EIP当前的绑定对象为ECS实例,则只有状态为运行中或已停止的ECS实例,才能够执行解绑操作。

  若EIP当前的绑定对象为HaVip实例,则只有状态为InUse的HaVip实例,才能够执行解绑操作。

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:UnassociateEipAddress AllocationId String 是 EIP实例Id InstanceType String 否 绑定的对象类型。
取值范围:ECSInstance | HaVip
默认值:ECSInstance InstanceId String 是 需要进行解绑操作的具体对象Id。

  返回参数

  全是公共返回参数,详见公共返回参数

  错误码

错误代码 描述 Http 状态码 语义 IncorrectEipStatus Current elastic IP status does not support this operation. 400 指定的EIP的当前状态不支持解绑操作。 InvalidAllocationId.NotFound Specified allocation ID is not found. 404 指定的EIP的申请Id不存在,解绑失败。 InvalidInstanceId.NotFound Specified instance does not exist. 400 指定的ECS实例不存在,解绑失败。 IncorrectInstanceStatus The current status of instance does not support this operation. 400 指定ECS实例当前状态不支持解绑操作,解绑操作失败。 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported. 400 InstanceType的输入值不合法 InvalidHaVip.NotFound The specified HaVip does not exist. 404 InstanceType为HaVip,且InstanceId并不是一个真实存在的有效HaVipId。 ResourceNotAssociated The specified resources are not associated. 400 指定的要解绑定的资源并没有绑定在一起。 IncorrectHaVipStatus This operation is denied because satus of the specified HaVip is neither Available nor InUse. 400 只有当HaVip的状态为Available或者InUse时,才允许将一个EIP与一个HaVip解绑。

  示例

  请求示例

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

  &AllocationId=eip-2578g5v5a

  &InstanceId=i-25skktcp4

  &<公共请求参数>

  返回示例

7.png

  释放弹性公网 IP

  描述

  释放 EIP,释放后的 IP 地址,不再属于您的名下

  只有 Available 状态的 EIP 才可以释放

  请求参数

名称 类型 是否必须 描述 Action String 是 系统规定参数,取值:ReleaseEipAddress AllocationId String 是 要执行释放操作的 EIP 对应的申请 Id

  返回参数

  全是公共返回参数,详见公共返回参数

  错误码

错误代码 描述 Http 状态码 语义 IncorrectEipStatus Current elastic IP status does not support this operation. 400 指定的 EIP 的当前状态不支持释放,释放操作失败。

  示例

  请求示例

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

  &AllocationId=eip-25877c70x

  &<公共请求参数>

  返回示例

8.png

(责任编辑:豆豆)
下一篇:

Hadoop datanode重新加载失败无法启动解决

上一篇:

水星路由器怎么隐藏信号

  • 信息二维码

    手机看新闻

  • 分享到
打赏
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们 xfptx@outlook.com