class Ec2Environment (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Cloud9.Alpha.Ec2Environment |
Go | github.com/aws/aws-cdk-go/awscdkcloud9alpha/v2#Ec2Environment |
Java | software.amazon.awscdk.services.cloud9.alpha.Ec2Environment |
Python | aws_cdk.aws_cloud9_alpha.Ec2Environment |
TypeScript (source) | @aws-cdk/aws-cloud9-alpha ยป Ec2Environment |
Implements
IConstruct
, IDependable
, IResource
, IEc2
A Cloud9 Environment with Amazon EC2.
Example
import * as iam from 'aws-cdk-lib/aws-iam';
const user = new iam.User(this, 'user');
user.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AWSCloud9Administrator'));
declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
vpc,
imageId: cloud9.ImageId.AMAZON_LINUX_2,
owner: cloud9.Owner.user(user)
})
Initializer
new Ec2Environment(scope: Construct, id: string, props: Ec2EnvironmentProps)
Parameters
- scope
Construct
- id
string
- props
Ec2
Environment Props
Construct Props
Name | Type | Description |
---|---|---|
image | Image | The image ID used for creating an Amazon EC2 environment. |
vpc | IVpc | The VPC that AWS Cloud9 will use to communicate with the Amazon Elastic Compute Cloud (Amazon EC2) instance. |
automatic | Duration | The number of minutes until the running instance is shut down after the environment was last used. |
cloned | Clone [] | The AWS CodeCommit repository to be cloned. |
connection | Connection | The connection type used for connecting to an Amazon EC2 environment. |
description? | string | Description of the environment. |
ec2 | string | Name of the environment. |
instance | Instance | The type of instance to connect to the environment. |
owner? | Owner | Owner of the environment. |
subnet | Subnet | The subnetSelection of the VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance. |
imageId
Type:
Image
The image ID used for creating an Amazon EC2 environment.
vpc
Type:
IVpc
The VPC that AWS Cloud9 will use to communicate with the Amazon Elastic Compute Cloud (Amazon EC2) instance.
automaticStop?
Type:
Duration
(optional, default: The instance will not be shut down automatically.)
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."
clonedRepositories?
Type:
Clone
[]
(optional, default: do not clone any repository)
The AWS CodeCommit repository to be cloned.
connectionType?
Type:
Connection
(optional, default: CONNECT_SSH)
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)
description?
Type:
string
(optional, default: no description)
Description of the environment.
ec2EnvironmentName?
Type:
string
(optional, default: automatically generated name)
Name of the environment.
instanceType?
Type:
Instance
(optional, default: t2.micro)
The type of instance to connect to the environment.
owner?
Type:
Owner
(optional, default: The identity that CloudFormation executes under will be the owner)
Owner of the environment.
The owner has full control of the environment and can invite additional members.
subnetSelection?
Type:
Subnet
(optional, default: all public subnets of the VPC are selected.)
The subnetSelection of the VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance.
Properties
Name | Type | Description |
---|---|---|
ec2 | string | The environment ARN of this Cloud9 environment. |
ec2 | string | The environment name of this Cloud9 environment. |
env | Resource | The environment this resource belongs to. |
environment | string | The environment ID of this Cloud9 environment. |
ide | string | The complete IDE URL of this Cloud9 environment. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
vpc | IVpc | VPC ID. |
ec2EnvironmentArn
Type:
string
The environment ARN of this Cloud9 environment.
ec2EnvironmentName
Type:
string
The environment name of this Cloud9 environment.
env
Type:
Resource
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.
environmentId
Type:
string
The environment ID of this Cloud9 environment.
ideUrl
Type:
string
The complete IDE URL of this Cloud9 environment.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
vpc
Type:
IVpc
VPC ID.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | import from EnvironmentEc2Name. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromEc2EnvironmentName(scope, id, ec2EnvironmentName)
public static fromEc2EnvironmentName(scope: Construct, id: string, ec2EnvironmentName: string): IEc2Environment
Parameters
- scope
Construct
- id
string
- ec2EnvironmentName
string
Returns
import from EnvironmentEc2Name.