There are more AWS SDK examples available in the AWS Doc SDK Examples
Use CreateEnvironmentEc2 with a CLI
The following code examples show how to use CreateEnvironmentEc2.
- CLI
-
- AWS CLI
-
To create an AWS Cloud9 EC2 development environment
This following
create-environment-ec2example creates an AWS Cloud9 development environment with the specified settings, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance, and then connects from the instance to the environment.aws cloud9 create-environment-ec2 \ --namemy-demo-env\ --description"My demonstration development environment."\ --instance-typet2.micro--image-idamazonlinux-2023-x86_64\ --subnet-idsubnet-1fab8aEX\ --automatic-stop-time-minutes60\ --owner-arnarn:aws:iam::123456789012:user/MyDemoUserOutput:
{ "environmentId": "8a34f51ce1e04a08882f1e811bd706EX" }For more information, see Creating an EC2 Environment in the AWS Cloud9 User Guide.
-
For API details, see CreateEnvironmentEc2
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example creates an AWS Cloud9 development environment with the specified settings, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance, and then connects from the instance to the environment.
New-C9EnvironmentEC2 -Name my-demo-env -AutomaticStopTimeMinutes 60 -Description "My demonstration development environment." -InstanceType t2.micro -OwnerArn arn:aws:iam::123456789012:user/MyDemoUser -SubnetId subnet-d43a46EXOutput:
ffd88420d4824eeeaeaa8a04bfde8cEX-
For API details, see CreateEnvironmentEc2 in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example creates an AWS Cloud9 development environment with the specified settings, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance, and then connects from the instance to the environment.
New-C9EnvironmentEC2 -Name my-demo-env -AutomaticStopTimeMinutes 60 -Description "My demonstration development environment." -InstanceType t2.micro -OwnerArn arn:aws:iam::123456789012:user/MyDemoUser -SubnetId subnet-d43a46EXOutput:
ffd88420d4824eeeaeaa8a04bfde8cEX-
For API details, see CreateEnvironmentEc2 in AWS Tools for PowerShell Cmdlet Reference (V5).
-