Ec2Environment
- class aws_cdk.aws_cloud9_alpha.Ec2Environment(scope, id, *, image_id, vpc, cloned_repositories=None, connection_type=None, description=None, ec2_environment_name=None, instance_type=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_codecommit as codecommit # create a new Cloud9 environment and clone the two repositories # vpc: ec2.Vpc # create a codecommit repository to clone into the cloud9 environment repo_new = codecommit.Repository(self, "RepoNew", repository_name="new-repo" ) # import an existing codecommit repository to clone into the cloud9 environment repo_existing = codecommit.Repository.from_repository_name(self, "RepoExisting", "existing-repo") cloud9.Ec2Environment(self, "C9Env", vpc=vpc, cloned_repositories=[ cloud9.CloneRepository.from_code_commit(repo_new, "/src/new-repo"), cloud9.CloneRepository.from_code_commit(repo_existing, "/src/existing-repo") ], image_id=cloud9.ImageId.AMAZON_LINUX_2 )
- 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.cloned_repositories (
Optional
[Sequence
[CloneRepository
]]) – (experimental) The AWS CodeCommit repository to be cloned. Default: - do not clone any repositoryconnection_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_SSHdescription (
Optional
[str
]) – (experimental) Description of the environment. Default: - no descriptionec2_environment_name (
Optional
[str
]) – (experimental) Name of the environment. Default: - automatically generated nameinstance_type (
Optional
[InstanceType
]) – (experimental) The type of instance to connect to the environment. Default: - t2.microsubnet_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
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, 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 extendsConstruct
.
- 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