CreateInstance_边缘节点服务 ENS_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

  • 单用户调用频率:10 次/秒。
  • 由于创建实例是异步操作,建议您适当增加请求时间。当 API 返回 Code=0 时仅代表请求成功,并不代表成功创建实例,在请求成功时会返回实例 ID,然后您可以根据实例 ID 查询实例是否创建成功。
  • InvalidUserData.NotInWhiteList 接口限制条件:只有配置了购买权限的相关白名单才可以进行创建,否则报错。

流控信息

请求速率为10/1(s)。

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
ens:CreateInstance
Create
Instance
acs:ens:*:{#accountId}:instance/*

请求参数

字段名称字段详情
InstanceTypestring

实例规格。展开详情

示例值:ens.se1.tiny参考取值来源:
    DescribeInstanceTypes
    CreateEpnInstance
EnsRegionIdstring

地域。

示例值:cn-hangzhou参考取值来源:
    DescribeEnsRegions
Passwordstring

实例的密码。展开详情

示例值:yourPassword:1
Periodstring

购买资源的时长,取值范围:1~912,单位:月。

示例值:12
ImageIdstring

镜像文件 ID,启动实例时选择的镜像资源。

示例值:yourImage ID参考取值来源:
    ImportImage
    CreateImage
    DescribeAICImages
SystemDisk.Sizestring

系统盘大小,单位为 GiB。取值:2040,不能比镜像小,需要为 10 的倍数。

示例值:40
Quantitystring

实例数量。

示例值:1
DataDisk.1.Sizestring

第一块数据盘的容量大小,单位为 GiB,容量至少为 20 GiB 且为 10 的倍数。

示例值:50
InternetChargeTypestring

如果您第一次创建该参数为必传。如果已有实例资源,则默认按照已存在的计费方式。取值:展开详情

示例值:95BandwidthByMonth参考取值来源:
    DescribeBandwitdhByInternetChargeType
AutoRenewPeriodstring

每次自动续费的时长,当参数 AutoRenew 取值 True 时为必填。取值:1~12,单位:月。

示例值:12
AutoRenewstring

是否要自动续费。取值:True|False(默认值)。

示例值:True参考取值来源:
    DescribeInstanceAutoRenewAttribute
IpTypestring

IP 类型。取值:展开详情

示例值:ipv4枚举值:ipv4Andipv6ipv4ipv6
KeyPairNamestring

密钥对名称。仅支持传单个名称。

示例值:TestKeyPairName参考取值来源:
    CreateKeyPair
    ImportKeyPair
    DescribeKeyPairs
UserDatastring

自定义数据,以#!开头。目前,最长支持 256 字符,最大支持 16 KB。传参内容仅支持自定义数据 Script,不支持 InstanceMetaData 渲染。展开详情

示例值:#!/bin/sh echo "Hello World. The time is now $(date -R)!" | tee /home/output.txt
VSwitchIdstring

交换机 ID。

示例值:YourVSwitchId参考取值来源:
    CreateVSwitch
    DescribeVSwitches
PrivateIpAddressstring

内网地址。展开详情

示例值:10.10.10.10参考取值来源:
    AssignPrivateIpAddresses
PaymentTypestring

支付方式。目前为固定值 Subscription:预付费实例,暂不支持修改。

示例值:Subscription枚举值:Subscription
InstanceNamestring

实例的名称。命名规则如下所示:展开详情

示例值:test:Instance_Name.1-2参考取值来源:
    DescribeInstances
HostNamestring

云服务器的主机名。展开详情

示例值:test-HostName
UniqueSuffixboolean

是否为 HostNameInstanceName 添加有序后缀。有序后缀从 001 开始递增,最大不能超过 999展开详情

示例值:false
PublicIpIdentificationboolean

公网 IP 是否可以分配给指定实例。取值:展开详情

示例值:true
PasswordInheritboolean

是否使用镜像预设的密码。取值:展开详情

示例值:false

返回参数

字段名称字段详情
RequestIdstring

请求 ID。

示例值:4A431388-2D4B-46F4-A96B-D4E6BD0688C1
InstanceIdsobject
Codeinteger<int32>

返回码,成功返回 0。展开详情

示例值:0

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
StockNotEnough
The specified instance type has insufficient resource.诊断
400
InvalidUserData.NotInWhiteList
The specified user is not authroized to perform this operation.诊断
400
MissingParameter
The input parameter that is mandatory for processing this request is not supplied.诊断
400
InstanceIdNotFound
The input parameter instancdId that is not found.诊断
400
NoPermission
Permission denied.诊断
400
CallInterface
Call Interface Happen Error.诊断
400
InvalidParameter
The input parameter is Invalid.诊断
400
InvalidParameter.%s
The specified field %s invalid. Please check it again.诊断
400
InvalidDiskSize.ValueNotSupported
The specified disk capacity is invalid. Specify another capacity and try again.诊断
400
InvalidParameter.Bandwidth
The specified parameter InternetChargeType is not valid.诊断
400
InvalidParameter.Image
The specified image does not support.诊断
400
InvalidParameter.InstanceType
The specified parameter InstanceType is not valid.诊断
400
InvalidAccountStatus.NotEnoughBalance
Your account does not have enough balance.诊断
400
unsupported_Ipv6Feature
This ensregion does not support creating instance of the IPv6 type. Select another type.诊断
400
Forbidden.CreateInstance
The user is not in the Goods whitelist of creating instance interface.诊断
400
ENS_OperationUnsupported_KeyPairName
The KeyPairNameis not available or image not support ssh key.诊断
400
ENS_DependencyViolation_WindowsInstance
The instance creating is window, only user password to login.诊断
400
ENS_PASSWORDORKEYPAIRNAME_MODULE_NOT_CHOOSEN
The required module pwd or keyPairName is not inputed诊断
400
InvalidPrivateIpAddress
Specified private IP address is not in the CIDR block of virtual switch.诊断
400
InvalidVSwitchId.NotFound
Specified virtual switch does not exist.诊断
400
InvalidPrivateIpAddress.Duplicated
Specified private IP address is duplicated.诊断
400
InvalidPasswordParam.Mismatch
The input password should be null when passwordInherit is true.诊断

变更历史

变更时间变更内容概要操作
2023-10-12
删除返回参数
2023-03-03
新增返回参数
2022-08-04
变更请求参数ImageId
2022-06-07
变更错误码400
2021-09-23
新增请求参数PublicIpIdentification

相关示例