Ec2Environment

class aws_cdk.aws_cloud9_alpha.Ec2Environment(scope, id, *, image_id, vpc, automatic_stop=None, cloned_repositories=None, connection_type=None, description=None, ec2_environment_name=None, instance_type=None, owner=None, subnet_selection=None)

Bases: Resource

(experimental) A Cloud9 Environment with Amazon EC2.

Stability:

experimental

Resource:

AWS::Cloud9::EnvironmentEC2

ExampleMetadata:

infused

Example:

import aws_cdk.aws_iam as iam
# vpc: ec2.Vpc


user = iam.User(self, "user")
user.add_managed_policy(iam.ManagedPolicy.from_aws_managed_policy_name("AWSCloud9Administrator"))
cloud9.Ec2Environment(self, "C9Env",
    vpc=vpc,
    image_id=cloud9.ImageId.AMAZON_LINUX_2,

    owner=cloud9.Owner.user(user)
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • image_id (ImageId) – (experimental) The image ID used for creating an Amazon EC2 environment.

  • vpc (IVpc) – (experimental) The VPC that AWS Cloud9 will use to communicate with the Amazon Elastic Compute Cloud (Amazon EC2) instance.

  • automatic_stop (Optional[Duration]) – (experimental) The number of minutes until the running instance is shut down after the environment was last used. Setting a value of 0 means the instance will never be automatically shut down.” Default: - The instance will not be shut down automatically.

  • cloned_repositories (Optional[Sequence[CloneRepository]]) – (experimental) The AWS CodeCommit repository to be cloned. Default: - do not clone any repository

  • connection_type (Optional[ConnectionType]) – (experimental) 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) Default: - CONNECT_SSH

  • description (Optional[str]) – (experimental) Description of the environment. Default: - no description

  • ec2_environment_name (Optional[str]) – (experimental) Name of the environment. Default: - automatically generated name

  • instance_type (Optional[InstanceType]) – (experimental) The type of instance to connect to the environment. Default: - t2.micro

  • owner (Optional[Owner]) – (experimental) Owner of the environment. The owner has full control of the environment and can invite additional members. Default: - The identity that CloudFormation executes under will be the owner

  • subnet_selection (Union[SubnetSelection, Dict[str, Any], None]) – (experimental) The subnetSelection of the VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance. Default: - all public subnets of the VPC are selected.

Stability:

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

ec2_environment_arn

(experimental) The environment ARN of this Cloud9 environment.

Stability:

experimental

Attribute:

true

ec2_environment_name

(experimental) The environment name of this Cloud9 environment.

Stability:

experimental

Attribute:

true

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

environment_id

(experimental) The environment ID of this Cloud9 environment.

Stability:

experimental

ide_url

(experimental) The complete IDE URL of this Cloud9 environment.

Stability:

experimental

node

The tree node.

stack

The stack in which this resource is defined.

vpc

(experimental) VPC ID.

Stability:

experimental

Static Methods

classmethod from_ec2_environment_name(scope, id, ec2_environment_name)

(experimental) import from EnvironmentEc2Name.

Parameters:
  • scope (Construct) –

  • id (str) –

  • ec2_environment_name (str) –

Stability:

experimental

Return type:

IEc2Environment

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool