CreateContainerGroup_弹性容器实例_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.

接口说明

调用 CreateContainerGroup 创建 ECI 实例时,系统将自动为您创建一个服务关联角色 AliyunServiceRoleForECI,用于访问 ECS、VPC 等相关云服务。更多信息,请参见弹性容器实例服务关联角色

创建 ECI 实例时,您可以根据需要配置实例、镜像、存储等相关功能。各功能涉及的参数及其说明,请参见以下功能文档:

实例

ECI 支持以下两种方式创建实例:

以下功能两种创建方式均支持:

镜像

网络

存储

容器配置

日志与运维

流控信息

当前云产品API请求速率暂未透出。

授权信息

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

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
eci:CreateContainerGroup
Create
ContainerGroup
acs:eci:{#regionId}:{#accountId}:containergroup/*
eci:tag

请求参数

字段名称字段详情
RegionIdstring

地域 ID。

示例值:cn-hangzhou参考取值来源:
    DescribeRegions
ZoneIdstring

实例所属的可用区。如果取值为空,则表示由系统选择。展开详情

示例值:cn-hangzhou-b参考取值来源:
    DescribeZones
SecurityGroupIdstring

实例所属的安全组 ID。同一个安全组内的实例之间可以互相访问。展开详情

示例值:sg-uf66jeqopgqa9hdn****参考取值来源:
    DescribeContainerGroups
VSwitchIdstring

实例所属的交换机 ID。支持指定多个交换机 ID(单次最多 10 个),各交换机 ID 之间可以用半角逗号(,)进行分割,例如vsw-***,vsw-***展开详情

示例值:vsw-bp1xpiowfm5vo8o3c****,vsw-bp1rkyjgr1xwoho6k****
ContainerGroupNamestring

ECI 实例名称,即容器组名称。格式要求如下:展开详情

示例值:nginx-test参考取值来源:
    DescribeContainerGroups
RestartPolicystring

实例重启策略。取值范围:展开详情

示例值:Always
EipInstanceIdstring

弹性公网 IP ID。

示例值:eip-uf66jeqopgqa9hdn****
Cpunumber<float>

实例级别 vCPU 大小。单位:核。

示例值:1.0
Memorynumber<float>

实例级别内存大小。单位:GiB。

示例值:2.0
ResourceGroupIdstring

资源组 ID。

示例值:rg-uf66jeqopgqa9hdn****参考取值来源:
    DescribeContainerGroups
DnsPolicystring

DNS 策略。取值范围:展开详情

示例值:Default
ClientTokenstring

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。只支持 ASCII 字符,且不能超过 64 个字符。更多详情,请参阅如何保证幂等性

示例值:123e4567-xxxx-12d3-xxxx-426655440000
InstanceTypestring

指定的 ECS 实例规格,支持多规格。更多信息,请参见指定 ECS 规格创建实例

示例值:ecs.c5.xlarge
ImageSnapshotIdstring

镜像缓存 ID。更多信息,请参见使用镜像缓存加速创建实例

示例值:imc-2zebxkiifuyzzlhl****
RamRoleNamestring

实例 RAM 角色名称。ECI 与 ECS 共用实例 RAM 角色,更多信息,请参见通过 API 使用实例 RAM 角色

示例值:RamTestRole
TerminationGracePeriodSecondsinteger<int64>

程序的缓冲时间,用于处理关闭之前的操作。单位为秒。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:60
AutoMatchImageCacheboolean

是否自动匹配镜像缓存。默认为 false。

示例值:false
Ipv6AddressCountinteger<int32>

IPv6 地址数。固定为 1,即一个 ECI 实例支持绑定一个 IPv6 地址。

示例值:1
ActiveDeadlineSecondsinteger<int64>

ECI 实例的有效期限,超出该时间后,实例会被强制退出。单位为秒。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:1000
SpotStrategystring

实例的抢占策略。取值范围:展开详情

示例值:SpotWithPriceLimit
SpotPriceLimitnumber<float>

设置抢占式实例的每小时最高价格,最多精确到小数点后 3 位。展开详情

示例值:0.025
ScheduleStrategystring

配置了多可用区(通过 VSwitchId 参数指定多个交换机)时,ECI 实例的调度策略。取值范围:展开详情

示例值:VSwitchOrdered
CorePatternstring

自定义设置 coredump 生成的 core 文件的保存目录。更多信息,请参见设置 core 文件保存到数据卷展开详情

示例值:/xx/xx/core
ShareProcessNamespaceboolean

是否使用共享命名空间。默认为 false。

示例值:false
AutoCreateEipboolean

是否自动创建一个 EIP,并绑定到 ECI 实例上。

示例值:true
EipBandwidthinteger<int32>

EIP 的带宽,默认为 5 Mbps。 展开详情

示例值:5取值 <= 1000000
EipISPstring

设置 EIP 的线路类型。取值范围:展开详情

示例值:BGP
EipCommonBandwidthPackagestring

绑定已有的共享带宽包。

示例值:cbwp-2zeukbj916scmj51m****
HostNamestring

主机名称。

示例值:test
IngressBandwidthinteger<int64>

入方向带宽限制。单位:Bps。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:1024000取值 <= 9223372036854775807
EgressBandwidthinteger<int64>

出方向带宽限制。单位:Bps。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:1024000取值 <= 9223372036854775807
CpuOptionsCoreinteger<int32>

CPU 物理核心数。仅部分规格支持自定义设置。

示例值:2取值 <= 1000
CpuOptionsThreadsPerCoreinteger<int32>

每核线程数。仅部分规格支持自定义设置。配置为 1 时表示关闭超线程。

示例值:2取值 <= 1000
CpuOptionsNumastring

该参数暂不支持设置。

示例值:1
EphemeralStorageinteger<int32>

增加的临时存储空间大小。单位:GiB。 展开详情

示例值:20取值 <= 5000
Tagarray<object>

标签列表。最多可以绑定 20 个。更多信息,请参见使用标签管理实例

子级条数 <= 21
ImageRegistryCredentialarray<object>

镜像仓库信息。

子级条数 <= 11
Containerarray<object>

容器信息。

子级条数 <= 41
Volumearray<object>

数据卷信息。

子级条数 <= 101
InitContainerarray<object>

Init 容器列表。

子级条数 <= 41
DnsConfig.NameServerarray<string>

DNS 服务器的 IP 地址列表。

示例值:172.10.*.**子级条数 <= 20
DnsConfig.Searcharray<string>

DNS 搜索域列表。

示例值:svc.local.kubenetes子级条数 <= 20
DnsConfig.Optionarray<object>

对象的选项列表。

子级条数 <= 20
HostAliasearray<object>

添加一个 ECI 的别名。

子级条数 <= 101
SecurityContext.Sysctlarray<object>

通过安全上下文修改安全 sysctl 参数。更多信息,请参见配置 Security Context

子级条数 <= 101
HostSecurityContext.Sysctlarray<object>

通过安全上下文修改非安全 sysctl 参数。更多信息,请参见配置 Security Context

子级条数 <= 101
NtpServerarray<string>

NTP 服务器。

示例值:ntp.cloud.aliyuncs.com子级条数 <= 21
AcrRegistryInfoarray<object>

ACR 企业版实例信息列表。更多信息,请参见免密拉取 ACR 镜像

子级条数 <= 21
SpotDurationinteger<int64>

抢占式实例的保护期。单位为小时。默认为 1。可设置为 0,表示无保护期。

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:1
StrictSpotboolean

是否周期执行:展开详情

示例值:true
PlainHttpRegistrystring

自建镜像仓库地址。使用 HTTP 协议的自建镜像仓库中的镜像创建 ECI 实例时,需配置该参数,使得 ECI 使用 HTTP 协议拉取镜像,避免因协议不同而导致镜像拉取失败。

示例值:"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"
InsecureRegistrystring

自建镜像仓库地址。使用自签发证书的自建镜像仓库中的镜像创建 ECI 实例时,需配置该参数来跳过证书认证,避免因证书认证失败而导致镜像拉取失败。

示例值:"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"
ImageAccelerateModestring

镜像加速模式。取值范围:展开详情

示例值:imc
Ipv6GatewayBandwidthEnableboolean

是否开通 ECI 的 IPv6 公网通信能力。

示例值:true
Ipv6GatewayBandwidthstring

当 Ipv6GatewayBandwidthEnable 配置为 true 时,配置 IPv6 地址的公网带宽峰值。取值如下:展开详情

示例值:100
ContainerResourceViewboolean

当 ECI 规格比申请规格大时,可以开启该配置,确保容器内看到的资源跟申请的资源保持一致。

示例值:false
FixedIpstring

配置为 true 表示实例启用固定 IP 地址。具体请参见配置 ECI 实例使用固定 IP 地址

示例值:true
FixedIpRetainHourinteger<int32>

固定 IP 地址空闲后的保留时长,即启用固定 IP 地址的实例释放后,其固定 IP 地址的保留时长,单位为小时。默认值为 48。

示例值:24
DataCacheBucketstring

数据缓存 Bucket。

示例值:default参考取值来源:
    DescribeDataCaches
DataCachePLstring

数据缓存使用的云盘的性能等级。 展开详情

示例值:PL1
DataCacheProvisionedIopsinteger<int64>

数据缓存使用 ESSD AutoPL 云盘时,ESSD AutoPL 云盘预配置的读写 IOPS。 展开详情

注意 该字段类型为 Long,在序列化/反序列化的过程中可能导致精度丢失,请注意数值不得大于 9007199254740991。
示例值:40000
DataCacheBurstingEnabledboolean

数据缓存使用 ESSD AutoPL 云盘时,是否开启 Burst(性能突发)。更多信息,请参见ESSD AutoPL 云盘

示例值:false
DryRunboolean

是否只预检此次请求。取值范围:展开详情

示例值:false
PrivateIpAddressstring

指定 ECI 实例的私网 IP 地址。目前仅支持指定 IPv4 地址,请确保该 IP 地址没有被占用。

示例值:172.16.0.1
OsTypestring

指定 ECI 实例的操作系统。取值范围:展开详情

示例值:Windows
CpuArchitecturestring

指定 ECI 实例的 CPU 架构。取值范围:展开详情

示例值:ARM64
ComputeCategoryarray<string>

指定算力类别。更多信息,请参见指定算力类别创建实例

子级条数 <= 100
GpuDriverVersionstring

指定 GPU 驱动版本。展开详情

示例值:tesla=535

返回参数

字段名称字段详情
RequestIdstring

请求 ID,唯一标识。

示例值:89945DD3-9072-47D0-A318-353284CFC7B3
ContainerGroupIdstring

实例 ID,即容器组 ID。

示例值:eci-uf6fonnghi50u374****

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
Account.Arrearage
Your account has an outstanding payment.诊断
400
DryRunOperation
Request validation has been passed with DryRun flag set.诊断
400
InvalidParameter.CPU.Memory
The specified cpu and memory are not allowed诊断
400
InvalidParameter.DuplicatedName
The container group include containers with duplicate names.诊断
400
InvalidParameter.DuplicatedVolumeName
The container group includes volumes with duplicate names.诊断
400
IncorrectStatus
%s诊断
400
ServiceNotEnabled
%s诊断
400
ImageSnapshot.IncorrectStatus
%s诊断
400
ImageSnapshot.NotSupport
%s诊断
400
DiskVolume.NotSupport
The disk volume is not supported.诊断
400
RamRole.NotSupport
The RAM role is not supported.诊断
400
DiskNumber.LimitExceed
The maximum number of disks in an instance is exceeded.诊断
400
InvalidPaymentMethod.InsufficientBalance
No payment method is specified for your account. We recommend that you add a payment method or add funds to the prepayment balance.诊断
400
DiskVolume.NotInSameZone
The instance to be created and the disk are not in the same zone.诊断
400
NoPermission
You are not authorized to use the "Product on ECI" feature.诊断
400
HighCpuMemConfigRequired
You need to apply to be added to the whitelist of the specified CPU and memory.诊断
400
RecommendEmpty.InstanceTypeFamilyNotMatched
The recommended instance type is unavailable in the current zone. Try again later.诊断
400
LocalDiskAmountNotMatch
The number of local volumes does not match the instance type.诊断
400
Payfor.CreditPayInsufficientBalance
Your payment credit line is insufficient.诊断
400
InvalidOperation.KMS.InstanceTypeNotSupport
The specified instance is invalid. Only I/O optimized instances support KMS key.诊断
400
InvalidParameter.Encrypted.KmsNotEnabled
KMS must be enabled for encrypted disks.诊断
400
InvalidParameter.KMS.EncryptedIllegal
After configuring the parameter KmsKeyId, you must enable encryption.诊断
400
InvalidSpotCpuMemorySpec
The specified CPU and memory are not allowed. You must create spot ECI using standard ECS specifications for CPU and memory.诊断
400
Ipv6AddressNotSupportVsw
IPv6 is not supported in the specified vSwitch.诊断
400
Ipv6AddressNotSupport
Ipv6 is not supported in specified region.诊断
400
Ipv6AddressNotSupportInstanceType
IPv6 is not supported for the specified instance type.诊断
400
EipPayInsufficientBalance
Your account does not have enough balance to purchase eip.诊断
400
EipPurchaseFlowControl
Request was denied due to eip frequent purchase.诊断
400
Throttling
You have made too many requests within a short time; your request is denied due to request throttling诊断
400
JobInstanceBatchCreateNotSupport
ECI job instance not support batch create诊断
400
JobInstanceDiskNotSupport
ECI job instance not support disk volume诊断
400
JobInstanceEipNotSupport
ECI job instance not support eip诊断
400
JobInstanceFeatureNotMatch
ECI job instance feature not match诊断
400
JobInstanceImageCacheNotSupport
ECI job instance not support image cache诊断
400
JobInstanceIPv6NotSupport
ECI job instance not support IPv6诊断
400
JobInstanceRamRoleNotSupport
ECI job instance not support ram role诊断
400
JobInstanceRegionNotSupport
ECI job instance not support in this region诊断
400
JobInstanceSpotNotSupport
ECI job instance not support spot诊断
400
InvalidInstanceTypeForEciSpotDurationBuy
Current instance type does not support spot duration instance.诊断
400
InvalidInstanceTypeForEciBuy
Sales of this current instance type is not supported in eci.诊断
400
InstanceTypeNotMatchCpuArch
%s.诊断
400
JobInstanceEcsInstanceTypeNotSupport
Job-optimized elastic container instances cannot be created by specifying ECS instance types.诊断
400
PrivatePoolInstanceSpotNotSupport
Spot is not supported for PrivatePool.诊断
400
DryRun.Success
This request is a dryrun request with successful result.诊断
400
PrivateIpAddress.Already.InUse
The specific PrivateIpAddress already in use.诊断
400
IncorrectOperation
%s诊断
400
FeatureBasedConstraintConflict
A conflict occurs in specified feature constraints: [%s].诊断
400
OperationFailed.RiskControl
%s.诊断
400
RISK.RISK_CONTROL_REJECTION
To protect the security of your account, your request has been denied by the risk control system. Please contact Alibaba Cloud Customer Service for details.诊断
400
InvalidInstanceTypeForRaid
%s.诊断
403
OperationDenied.VswZoneMisMatch
The specified VSwitchId is not in the specified Zone.诊断
403
QuotaExceeded
%s quota exceeded.诊断
403
Zone.NotOnSale
The specified zone is not available for purchase.诊断
403
Forbidden.RiskControl
This operation has been identified as an abnormal operation and cannot be processed.诊断
403
Forbidden.SubUser
The specified action is not available for you.诊断
403
Forbidden.OnlyForInvitedTest
Eci create action is only open to invited users during public beta.诊断
403
OperationDenied.SecurityGroupMisMatch
The specified VSwitchId and SecurityGroupId are not in the same VPC.诊断
403
InvalidVSwitchId.IpNotEnough
The specified VSwitch does not have enough IP addresses.诊断
403
Forbidden.UserBussinessStatus
This operation is not allowed, because you have overdue bills. Pay the overdue bill and try again.诊断
403
Forbidden.UserNotRealNameAuthentication
This operation is not allowed, because you have not passed the real-name verification.诊断
403
InvalidUser.PassRoleForbidden
The RAM user is not authorized to assume a RAM role.诊断
403
NoPermission
The RAM role does not belong to ECS.诊断
403
OperationDenied.NoStock
Sales of this resource are temporarily suspended in the specified zone. We recommend that you use the multi-zone creation function to avoid the risk of insufficient resource. For more information, see https://help.aliyun.com/document_detail/157290.html诊断
403
InvalidParameter.KMS.KeyId.Forbidden
You are not authorized to access the specified KMSKeyId.诊断
403
Forbidden.AccountClosed
The operation is forbidden. Your account has been closed.诊断
403
InvalidOperation.ResourceManagedByCloudProduct
The operation is forbidden. The security group has been managed by another cloud product.诊断
403
Spot.NotMatched
%s. We recommend that you use the create multi-zone function to avoid insufficient inventory. For more information, see https://help.aliyun.com/document_detail/157290.html诊断
403
SecurityRisk.3DVerification
We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.诊断
403
CreateServiceLinkedRole.Denied
Please make sure the account has ram:CreateServiceLinkedRole permission.诊断
403
Throttling.Vcpu.PerDay
The maximum number of request for the day has been exceeded.诊断
403
FeatureAccessRestricted
Access to this feature:[%s] is restricted. Please contact Alibaba Cloud ECI support to request access.诊断
404
ImageSnapshot.NotFound
The specified snapshot does not exist.诊断
404
InvalidDiskId.NotFound
The specified disk does not exist.诊断
404
InvalidParameter.KMS.KeyId.NotFound
The specified KMSKeyId does not exist.诊断

变更历史

暂无变更历史

相关示例