create_environment_ec2
async
¶
create_environment_ec2(
name: EnvironmentName,
instance_type: InstanceType,
image_id: ImageId,
*,
config_overrides: Optional[AsyncCloud9ClientConfig] = None,
description: Optional[EnvironmentDescription] = None,
client_request_token: Optional[ClientRequestToken] = None,
subnet_id: Optional[SubnetId] = None,
automatic_stop_time_minutes: Optional[AutomaticStopTimeMinutes] = None,
owner_arn: Optional[UserArn] = None,
tags: Optional[TagList] = None,
connection_type: Optional[ConnectionType] = None,
dry_run: Optional[NullableBoolean] = None,
) -> CreateEnvironmentEC2Result
Creates an Cloud9 development environment, launches an Amazon Elastic Compute Cloud (Amazon EC2) instance, and then connects from the instance to the environment.
Cloud9 is no longer available to new customers. Existing customers of Cloud9 can continue to use the service as normal. Learn more"
Parameters:
-
name(EnvironmentName) –The name of the environment to create.
This name is visible to other IAM users in the same Amazon Web Services account.
-
description(Optional[EnvironmentDescription], default:None) –The description of the environment to create.
-
client_request_token(Optional[ClientRequestToken], default:None) –A unique, case-sensitive string that helps Cloud9 to ensure this operation completes no more than one time.
For more information, see Client Tokens in the Amazon EC2 API Reference.
-
instance_type(InstanceType) –The type of instance to connect to the environment (for example,
t2.micro). -
subnet_id(Optional[SubnetId], default:None) –The ID of the subnet in Amazon VPC that Cloud9 will use to communicate with the Amazon EC2 instance.
-
image_id(ImageId) –The identifier for the Amazon Machine Image (AMI) that's used to create the EC2 instance. To choose an AMI for the instance, you must specify a valid AMI alias or a valid Amazon EC2 Systems Manager (SSM) path.
We recommend using Amazon Linux 2023 as the AMI to create your environment as it is fully supported.
From December 16, 2024, Ubuntu 18.04 will be removed from the list of available
imageIdsfor Cloud9. This change is necessary as Ubuntu 18.04 has ended standard support on May 31, 2023. This change will only affect direct API consumers, and not Cloud9 console users.Since Ubuntu 18.04 has ended standard support as of May 31, 2023, we recommend you choose Ubuntu 22.04.
AMI aliases
-
Amazon Linux 2023 (recommended):
amazonlinux-2023-x86_64 -
Ubuntu 22.04:
ubuntu-22.04-x86_64
SSM paths
-
Amazon Linux 2023 (recommended):
resolve:ssm:/aws/service/cloud9/amis/amazonlinux-2023-x86_64 -
Ubuntu 22.04:
resolve:ssm:/aws/service/cloud9/amis/ubuntu-22.04-x86_64
-
-
automatic_stop_time_minutes(Optional[AutomaticStopTimeMinutes], default:None) –The number of minutes until the running instance is shut down after the environment has last been used.
-
owner_arn(Optional[UserArn], default:None) –The Amazon Resource Name (ARN) of the environment owner. This ARN can be the ARN of any IAM principal. If this value is not specified, the ARN defaults to this environment's creator.
-
tags(Optional[TagList], default:None) –An array of key-value pairs that will be associated with the new Cloud9 development environment.
-
connection_type(Optional[ConnectionType], default:None) –The connection type used for connecting to an Amazon EC2 environment. Valid values are
CONNECT_SSH(default) andCONNECT_SSM(connected through Amazon EC2 Systems Manager).For more information, see Accessing no-ingress EC2 instances with Amazon EC2 Systems Manager in the Cloud9 User Guide.
-
dry_run(Optional[NullableBoolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation.
Raises:
-
BadRequestException–The target request is invalid.
-
ConflictException–A conflict occurred.
-
ForbiddenException–An access permissions issue occurred.
-
InternalServerErrorException–An internal server error occurred.
-
LimitExceededException–A service limit was exceeded.
-
NotFoundException–The target resource cannot be found.
-
TooManyRequestsException–Too many service requests were made over the given time period.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
CreateEnvironmentEC2
>>> await client.create_environment_ec2(name='my-demo-environment', description='This is my demonstration environment.', instance_type='t2.micro', image_id='amazonlinux-2023-x86_64', subnet_id='subnet-6300cd1b', automatic_stop_time_minutes=60, owner_arn='arn:aws:iam::123456789012:user/MyDemoUser')
Source code in docs_src/capo_cloud9/_services/async_cloud9.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |