CreateComputeEnv

Last updated: 2019-07-08 20:38:15

1. API Description

API request domain name: batch.tencentcloudapi.com.

This API is used to create a compute environment.

Default API request frequency limit: 2 times/second.

2. Input Parameters

The following list of request parameters lists only the API request parameters and some common parameters. For the complete list of common parameters, see Common Request Parameters.

Parameter name Required Type Description
Action Yes String Common parameter; the value for this API: CreateComputeEnv
Version Yes String Common parameter; the value for this API: 2017-03-12
Region Yes String Common parameters; for details, see the Region List supported by the product.
ComputeEnv Yes NamedComputeEnv Compute environment information
Placement Yes Placement Location information
ClientToken No String A string used to guarantee the idempotency of the request. This string is generated by the user and must be unique for different requests. The maximum length is 64 ASCII characters. If this parameter is not specified, the idempotency of the request cannot be guaranteed.

3. Output Parameters

Parameter name Type Description
EnvId String Compute environment ID
RequestId String The unique request ID which is returned for each request. The RequestId for the current request needs to be provided when troubleshooting.

4. Examples

Example 1. Creating a Compute Environment

Input

https://batch.tencentcloudapi.com/?Action=CreateComputeEnv
&Placement.Zone=ap-guangzhou-2
&ComputeEnv.EnvName=test compute env
&ComputeEnv.EnvDescription=test compute env
&ComputeEnv.EnvType=MANAGED
&ComputeEnv.EnvData.InstanceType=S1.SMALL2
&ComputeEnv.EnvData.ImageId=img-bd78fy2t
&ComputeEnv.DesiredComputeNodeCount=1
&<Common request parameter>

Output

{
  "Response": {
    "EnvId": "env-3dhmblr3",
    "RequestId": "b2ac2379-6453-4eab-8f63-7ade00cb67b0"
  }
}

5. Developer Resources

It is recommended to use API 3.0 Explorer. This tool provides various capabilities such as online debugging, signature verification, SDK code generation and quick API retrieval that significantly reduce the difficulty of using cloud APIs.

Cloud API 3.0 comes with a set of complementary development tools that make it easier to call the API.

6. Error Codes

Only the error codes related to this API are listed below. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error
InvalidParameter.CvmParameters Invalid CVM parameter.
InvalidParameter.EnvDescriptionTooLong The compute environment description is too long.
InvalidParameter.EnvNameTooLong The compute environment name is too long.
InvalidParameter.NotificationEventNameDuplicate Duplicate message notification event name.
InvalidParameter.NotificationTopicName Invalid topic name.
InvalidParameter.NotificationTopicNameTooLong The topic name is too long.
InvalidParameterValue.ComputeEnv Compute environment parameter validation failed.
InvalidParameterValue.InstanceType The specified instance type is not supported.
InvalidParameterValue.LocalPath Invalid local storage path.
InvalidParameterValue.Negative Invalid negative parameter.
InvalidParameterValue.RemoteStoragePath Invalid storage path format.
InvalidParameterValue.RemoteStorageSchemeType Invalid storage type.
LimitExceeded.ComputeEnvQuota Insufficient compute environment quota.
LimitExceeded.CpuQuota Insufficient CPU quota.
UnauthorizedOperation.UserNotAllowedToUseBatch It is prohibited to use Batch service.