AWS Cloud9
API Reference (API Version 2017-09-23)

CreateEnvironmentEC2

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", "description": "string", "instanceType": "string", "name": "string", "ownerArn": "string", "subnetId": "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.

automaticStopTimeMinutes

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

clientRequestToken

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

description

The description of the environment to create.

Type: String

Length Constraints: Maximum length of 200.

Required: No

instanceType

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

name

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

ownerArn

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|federated-user|assumed-role)\/?\S*

Required: No

subnetId

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

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.

environmentId

The ID of the environment that was created.

Type: String

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

Errors

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

BadRequestException

The target request is invalid.

HTTP Status Code: 400

ConflictException

A conflict occurred.

HTTP Status Code: 400

ForbiddenException

An access permissions issue occurred.

HTTP Status Code: 400

InternalServerErrorException

An internal server error occurred.

HTTP Status Code: 500

LimitExceededException

A service limit was exceeded.

HTTP Status Code: 400

NotFoundException

The target resource cannot be found.

HTTP Status Code: 400

TooManyRequestsException

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

HTTP Status Code: 400

Example

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

Sample Request

POST / HTTP/1.1 Host: cloud9.us-east-2.amazonaws.com 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: