CreateEnvironmentEC2 - AWS Cloud9


Creates an AWS Cloud9 development environment, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance, and then connects from the instance to the environment.

Request Syntax

{ "automaticStopTimeMinutes": number, "clientRequestToken": "string", "connectionType": "string", "description": "string", "instanceType": "string", "name": "string", "ownerArn": "string", "subnetId": "string", "tags": [ { "Key": "string", "Value": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


The number of minutes until the running instance is shut down after the environment has last been used.

Type: Integer

Valid Range: Maximum value of 20160.

Required: No


A unique, case-sensitive string that helps AWS Cloud9 to ensure this operation completes no more than one time.

For more information, see Client Tokens in the Amazon EC2 API Reference.

Type: String

Pattern: [\x20-\x7E]{10,128}

Required: No


The connection type used for connecting to an Amazon EC2 environment. Valid values are CONNECT_SSH (default) and CONNECT_SSM (connected through AWS Systems Manager).

For more information, see Accessing no-ingress EC2 instances with AWS Systems Manager in the AWS Cloud9 User Guide.

Type: String


Required: No


The description of the environment to create.

Type: String

Length Constraints: Maximum length of 200.

Required: No


The type of instance to connect to the environment (for example, t2.micro).

Type: String

Length Constraints: Minimum length of 5. Maximum length of 20.

Pattern: ^[a-z][1-9][.][a-z0-9]+$

Required: Yes


The name of the environment to create.

This name is visible to other AWS IAM users in the same AWS account.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 60.

Required: Yes


The Amazon Resource Name (ARN) of the environment owner. This ARN can be the ARN of any AWS IAM principal. If this value is not specified, the ARN defaults to this environment's creator.

Type: String

Pattern: ^arn:aws:(iam|sts)::\d+:(root|(user\/[\w+=/:,.@-]{1,64}|federated-user\/[\w+=/:,.@-]{2,32}|assumed-role\/[\w+=:,.@-]{1,64}\/[\w+=,.@-]{1,64}))$

Required: No


The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance.

Type: String

Length Constraints: Minimum length of 5. Maximum length of 30.

Required: No


An array of key-value pairs that will be associated with the new AWS Cloud9 development environment.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

{ "environmentId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


The ID of the environment that was created.

Type: String

Pattern: ^[a-zA-Z0-9]{8,32}$


For information about the errors that are common to all actions, see Common Errors.


The target request is invalid.

HTTP Status Code: 400


A conflict occurred.

HTTP Status Code: 400


An access permissions issue occurred.

HTTP Status Code: 400


An internal server error occurred.

HTTP Status Code: 500


A service limit was exceeded.

HTTP Status Code: 400


The target resource cannot be found.

HTTP Status Code: 400


Too many service requests were made over the given time period.

HTTP Status Code: 400



The following example creates an AWS Cloud9 development environment with the specified settings.

Sample Request

POST / HTTP/1.1 Host: Accept-Encoding: identity Content-Type: application/x-amz-json-1.1 User-Agent: aws-cli/1.14.29 Python/3.5.2 Windows/10 botocore/1.8.33 X-Amz-Date: 20180123T224817Z Content-Length: ... Authorization: AWS4-HMAC-SHA256 Credential=AKIAJ32OEXAMPLE/20180123/us-east-2/cloud9/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=6d4c1a32EXAMPLE X-Amz-Target: AWSCloud9WorkspaceManagementService.CreateEnvironmentEC2 { "ownerArn": "arn:aws:iam::123456789012:user/MyDemoUser", "name": "my-demo-environment", "automaticStopTimeMinutes": 60, "description": "This is my demonstration environment.", "instanceType": "t2.micro", "subnetId": "subnet-1fab8aEX" }

Sample Response

HTTP/1.1 200 OK Date: Tue, 23 Jan 2018 22:48:20 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 52 x-amzn-RequestId: 814f962e-008f-11e8-9a37-1ba143abb2EX Connection: Keep-alive { "environmentId": "8d9967e2f0624182b74e7690ad69ebEX" }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: