You can call this operation to create a deployment environment.

  • If you specify a source deployment environment or configuration template to create a deployment environment, the deployment package version corresponding to the source deployment environment or configuration template is used to create the new deployment environment.
  • If you specify neither a source deployment environment nor a source configuration template, you must specify the IDs of the technology stack and deployment package version used.
  • If you specify more than one of the source deployment environment ID, source configuration template ID, and technology stack ID, a deployment environment will be created by using the specified ID with the highest priority. The source deployment environment ID, source configuration template ID, and technology stack ID are arranged in descending order of priority.
  • If you are calling this operation to perform a change rather than a dry run, the change ID will be returned. You can use this change ID to query the change information.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request headers

This operation uses common request headers, instead of special request headers. For more information, see the "Common request headers" section in "Common request and response headers."

Request syntax

POST /pop/v1/wam/appEnv HTTP/1.1

Request parameters

Parameter Type Required? Example Description
AppId String No wa-6c937c98a9c0296d0c48*****

The ID of the application.

DryRun Boolean No false

Specifies whether to perform a dry run.

  • If this parameter is set to true, no change is created, but the steps for creating the deployment environment are returned. If this parameter is set to false, the deployment environment is created and the change ID is returned.
    • Default value: false.
EnvDescription String No this is an env

The description of the deployment environment.

EnvName String No envTest

The name of the deployment environment.

OptionSettings String No [{"path":"resources.ecs.autoScaling", "name":"instanceNum","value":"10"}, {"path":"application.option", "name":"port","value":"8081"}]

The custom configuration item data, in the format of a JSON array. The array contains the following fields:

  • path: the path to the configuration item.
  • name: the name of the configuration item.
  • value: the value of the configuration item.
PkgVersionId String No wp-6c937c98a9c0296d0c48*****

The ID of the deployment package version.

ProfileName String No HighAvailability

The type of the initial configuration. Valid values:

  • HighAvailability: high-availability configuration. In this configuration type, two ECS instances and one Internet SLB instance are used.
  • StandAlone: low-cost configuration. In this configuration type, only one ECS instance is used.
SourceEnvId String No we-6c937c98a9c0296d0c48*****

The ID of the source deployment environment whose technology stack, configuration items, and deployment package version are to be cloned to create the deployment environment.

StackId String No ws-6c937c98a9c0296d0c48*****

The ID of the technology stack used by the deployment environment. If you have specified the source deployment environment ID or configuration template ID, this parameter is invalid. If you specify neither a source deployment environment ID nor a source configuration template ID, you must set this parameter.

TemplateId String No wct-5d1c0a5d913567334af*****

The ID of the source configuration template.

Response parameters

Parameter Type Example Description
Code String OK

The response code. The value is OK if the request is successful.

EnvChangeDetail

The change information about the deployment environment.

ChangeId String wc-5d3e71642977ca5251e*****

The ID of the change.

EnvId String we-5d39b8ba6786bd4b149*****

The ID of the deployment environment.

Operations

The list of change operations.

OperationDescription String Bind to VSwitch vsw-wz9gfawx1vxkimtj*****

The description of the change operation.

OperationType String create

The type of the change operation.

StartTime String 1562666697684

The start time of the change.

Message String success

The response message. The value is success if the request is successful.

RequestId String 8D69F3C4-EA43-49D5-875A-0893BF5*****

The ID of the request.

Examples

Sample request


http://webplus.cn-hangzhou.aliyuncs.com/pop/v1/wam/appEnv?<Common request parameters>

Sample success response

XML format

<CreateAppEnvResponse>
    <Message>success</Message>
    <RequestId>3E85CF06-071C-4A90-B7A1-2ACBA56*****</RequestId>
    <EnvChangeDetail>
        <Operations>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Bind to VPC vpc-wz9e6y22o3o91nuy*****</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Bind to VSwitch vsw-wz9gfawx1vxkimtj*****</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Create security group</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>update</OperationType>
                <OperationDescription>Update ESS scaling group</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Create 1 ECS instances and create instances with priority using the following instance specifications: ecs.t5-*****.small,ecs. *****.small,ecs. *****.tiny,ecs. *****.large (Creating resources may incur charges, please see //www.aliyun.com/price/product ? #/ecs/detail ECS Pricing&gt;</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Setup platform services on ECS instance(s)</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>create</OperationType>
                <OperationDescription>Create monitor group</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>update</OperationType>
                <OperationDescription>Synchronous ECS instance(s) to monitor group</OperationDescription>
            </Operation>
            <Operation>
                <OperationType>update</OperationType>
                <OperationDescription>Change application on the instance(s)</OperationDescription>
            </Operation>
        </Operations>
    </EnvChangeDetail>
    <Code>OK</Code>
</CreateAppEnvResponse>

JSON format

{
	"Message":"success",
	"RequestId":"607E6D37-6037-48FD-A89E-A57C584*****",
	"EnvChangeDetail":{
		"Operations":{
			"Operation":[
				{
					"OperationType":"create",
					"OperationDescription":"Bind to VPC vpc-wz9e6y22o3o91nuy*****"
				},
				{
					"OperationType":"create",
					"OperationDescription":"Bind to VSwitch vsw-wz9gfawx1vxkimtj*****"
				},
				{
					"OperationType":"create",
					"OperationDescription":"Create security group"
				},
				{
					"OperationType":"update",
					"OperationDescription":"Update ESS scaling group"
				},
				{
					"OperationType":"create",
					"OperationDescription":"Create 1 ECS instances and create instances with priority using the following instance specifications: ecs.t5-*****.small,ecs. *****.small,ecs.n1.tiny,ecs. *****.large (<b>Creating resources may incur charges, please see <a href=\"//www.aliyun.com/price/product ? #/ecs/detail\" target=\"_blank\">ECS Pricing</a></b>)"
				},
				{
					"OperationType":"create",
					"OperationDescription":"Setup platform services on ECS instance(s)"
				},
				{
					"OperationType":"create",
					"OperationDescription":"Create monitor group"
				},
				{
					"OperationType":"update",
					"OperationDescription":"Synchronous ECS instance(s) to monitor group"
				},
				{
					"OperationType":"update",
					"OperationDescription":"Change application on the instance(s)"
				}
			]
		}
	},
	"Code":"OK"
}

Error codes

HTTP status code Error code Error message Description
500 ResourceAuthFailed The specified resource does not exist or it does not belong to this Alibaba Cloud account. The error message returned because the specified resource does not exist or it does not belong to your Alibaba Cloud account.
500 EnvCreateFailed An error occurred while creating an environment. The error message returned because an error occurred while creating a deployment environment. An unknown error occurred while inserting a new record to the database.
500 OSSDisabled You have not activated the OSS service and cannot use the WebPlus service. Please go to the OSS console (https://oss.console.aliyun.com) to activate OSS and try again. The error message returned because you have not activated OSS. Log on to the OSS console (https://oss.console.aliyun.com) and activate OSS before using Web+.
500 OSSApiCallFailed When initializing applications, updating configurations, or destroying applications, WebPlus attempts to communicate with OSS through API communication. An OSS service throw error occurred. The bucket or the file does not exist. The error message returned because an exception (such as the non-existence of a bucket or file) was thrown by OSS when Web+ attempted to communicate with OSS through the API to initialize an application, update the configuration, or destroy the application.
500 StackNotExists The declared software stack information does not exist. The error message returned because the declared technology stack information does not exist when you create or update a deployment environment for an application.
500 AppNotExist A corresponding application was not found based on the application ID. The error message returned because the application of the specified ID does not exist.
500 AppCategoryNotMatchWithStacks The application type declared in the application does not match the type of the software stack. Please make sure that the types are consistent and then try again. The error message returned because the platform type specified for the application is different from that in the technology stack. Use a consistent platform type and try again.
500 StackContainsNoConfigOption An error occurred while modifying the configuration. The corresponding software stack does not contain any configuration items. The error message returned because an error occurred while updating the configuration. The specified technology stack does not contain any configuration items.
404 ConfigOptionNotExists An error occurred while updating the configuration. The system did not locate the configuration item declared by the key. The error message returned because an error occurred while updating the configuration. The system did not locate the configuration item declared by the key.
500 ChangingAReadonlyConfig An error occurred while modifying the configuration. You cannot modify a read-only configuration. The error message returned because an error occurred while updating the configuration. You cannot modify a read-only configuration item.
500 ConfigValueInvalid An error occurred while resolving the configuration values. Please make sure the value type and constraints is consistent with the declared type. Types currently supported by WebPlus are: String, Integer, List, Boolean, Float, Json. The error message returned because an error occurred while resolving the values of configuration items. Ensure that the value types of configuration items are the same as the declared value types. Currently, Web+ supports the following value types: String, Integer, List, Boolean, Float, and JSON.
500 AppPackageNotExists An application deployment package is required to create or update a deployment environment. For the first time of using WebPlus, we recommend that you use a sample project. The error message returned because you did not use a real application deployment package when creating or updating a deployment environment. If you are using Web+ for the first time, we recommend that you use the sample project.
500 AppPackageOwnedByOthers The version of the deployment package used must be consistent with the application to which the environment belongs. The error message returned because the deployment package version used to create or update a deployment environment for an application does not belong to the application.

For more information about error codes, see API Error Center.