Namespace Amazon.CDK.AWS.Cloud9
AWS Cloud9 Construct Library
---AWS CDK v1 has reached End-of-Support on 2023-06-01.
This package is no longer being updated, and users should migrate to AWS CDK v2.
For more information on how to migrate, see the Migrating to AWS CDK v2 guide.
This module is part of the AWS Cloud Development Kit project.
AWS Cloud9 is a cloud-based integrated development environment (IDE) that lets you write, run, and debug your code with just a browser. It includes a code editor, debugger, and terminal. Cloud9 comes prepackaged with essential tools for popular programming languages, including JavaScript, Python, PHP, and more, so you don’t need to install files or configure your development machine to start new projects. Since your Cloud9 IDE is cloud-based, you can work on your projects from your office, home, or anywhere using an internet-connected machine. Cloud9 also provides a seamless experience for developing serverless applications enabling you to easily define resources, debug, and switch between local and remote execution of serverless applications. With Cloud9, you can quickly share your development environment with your team, enabling you to pair program and track each other's inputs in real time.
Creating EC2 Environment
EC2 Environments are defined with Ec2Environment
. To create an EC2 environment in the private subnet, specify
subnetSelection
with private subnetType
.
// create a cloud9 ec2 environment in a new VPC
var vpc = new Vpc(this, "VPC", new VpcProps { MaxAzs = 3 });
new Ec2Environment(this, "Cloud9Env", new Ec2EnvironmentProps { Vpc = vpc });
// or create the cloud9 environment in the default VPC with specific instanceType
var defaultVpc = Vpc.FromLookup(this, "DefaultVPC", new VpcLookupOptions { IsDefault = true });
new Ec2Environment(this, "Cloud9Env2", new Ec2EnvironmentProps {
Vpc = defaultVpc,
InstanceType = new InstanceType("t3.large")
});
// or specify in a different subnetSelection
var c9env = new Ec2Environment(this, "Cloud9Env3", new Ec2EnvironmentProps {
Vpc = vpc,
SubnetSelection = new SubnetSelection {
SubnetType = SubnetType.PRIVATE_WITH_NAT
}
});
// print the Cloud9 IDE URL in the output
// print the Cloud9 IDE URL in the output
new CfnOutput(this, "URL", new CfnOutputProps { Value = c9env.IdeUrl });
Cloning Repositories
Use clonedRepositories
to clone one or multiple AWS Codecommit repositories into the environment:
using Amazon.CDK.AWS.CodeCommit;
// create a new Cloud9 environment and clone the two repositories
Vpc vpc;
// create a codecommit repository to clone into the cloud9 environment
var repoNew = new Repository(this, "RepoNew", new RepositoryProps {
RepositoryName = "new-repo"
});
// import an existing codecommit repository to clone into the cloud9 environment
var repoExisting = Repository.FromRepositoryName(this, "RepoExisting", "existing-repo");
new Ec2Environment(this, "C9Env", new Ec2EnvironmentProps {
Vpc = vpc,
ClonedRepositories = new [] { CloneRepository.FromCodeCommit(repoNew, "/src/new-repo"), CloneRepository.FromCodeCommit(repoExisting, "/src/existing-repo") }
});
Classes
CfnEnvironmentEC2 | A CloudFormation |
CfnEnvironmentEC2.RepositoryProperty | The |
CfnEnvironmentEC2Props | Properties for defining a |
CloneRepository | (experimental) The class for different repository providers. |
ConnectionType | (experimental) The connection type used for connecting to an Amazon EC2 environment. |
Ec2Environment | (experimental) A Cloud9 Environment with Amazon EC2. |
Ec2EnvironmentProps | (experimental) Properties for Ec2Environment. |
Interfaces
CfnEnvironmentEC2.IRepositoryProperty | The |
ICfnEnvironmentEC2Props | Properties for defining a |
IEc2Environment | (experimental) A Cloud9 Environment. |
IEc2EnvironmentProps | (experimental) Properties for Ec2Environment. |