Updated on 2025-12-19 GMT+08:00

Creating an Environment

Function

This API is used to create an environment.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

POST /v1/{project_id}/cae/environments

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.

  • Enter 0 or up to 36 characters in UUID format with hyphens (-).

  • If this parameter is not specified or is set to 0, resources in the default enterprise project are queried.

NOTE:
For details about how to obtain enterprise project IDs and enterprise project features, see Enterprise Management User Guide.
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

kind

Yes

String

API type. Fixed value: Environment.

metadata

Yes

metadata object

Request data.

Table 4 metadata

Parameter

Mandatory

Type

Description

annotations

No

Map<String,String>

Additional parameters for creating an environment.

  • vpc_id: ID of the VPC bound to the created environment.

  • group_name: name of the SWR organization bound to the created environment.

  • type: environment type, which can only be exclusive.

  • subnet_id: ID of the VPC ingress subnet bound to the created environment.

  • egress_subnet_id: ID of the VPC egress subnet bound to the created environment.

  • elb_id: ID of the ELB bound to the created environment.

name

Yes

String

Environment name.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

Job ID.

Example Requests

Create environment test, and bind it to a VPC and organization cae-test.

POST https://{endpoint}/v1/{project_id}/cae/environments

{
  "api_version" : "v1",
  "kind" : "Environment",
  "metadata" : {
    "annotations" : {
      "vpc_id" : "9b320498-6c39-4fe7-a758-79636dd68a82",
      "group_name" : "cae-test",
      "type" : "exclusive",
      "subnet_id" : "1c75734a-132c-459f-86e2-a3db86a66b86",
      "security_group_id" : "e6c5a41d-8f47-48bd-a21b-0a4b10766aef"
    },
    "name" : "test"
  }
}

Example Responses

Status code: 200

OK

{
  "job_id" : "xxx"
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.