npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aws-cdk/aws-cloud9-alpha

v2.142.1-alpha.0

Published

The CDK Construct Library for AWS::Cloud9

Downloads

1,095

Readme

AWS Cloud9 Construct Library


cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


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
const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 3});
new cloud9.Ec2Environment(this, 'Cloud9Env', { vpc, imageId: cloud9.ImageId.AMAZON_LINUX_2, });

// or create the cloud9 environment in the default VPC with specific instanceType
const defaultVpc = ec2.Vpc.fromLookup(this, 'DefaultVPC', { isDefault: true });
new cloud9.Ec2Environment(this, 'Cloud9Env2', {
  vpc: defaultVpc,
  instanceType: new ec2.InstanceType('t3.large'),
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
});

// or specify in a different subnetSelection
const c9env = new cloud9.Ec2Environment(this, 'Cloud9Env3', {
  vpc,
  subnetSelection: {
    subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
  },
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
});

// print the Cloud9 IDE URL in the output
new CfnOutput(this, 'URL', { value: c9env.ideUrl });

Specifying EC2 AMI

Use imageId to specify the EC2 AMI image to be used:

const defaultVpc = ec2.Vpc.fromLookup(this, 'DefaultVPC', { isDefault: true });
new cloud9.Ec2Environment(this, 'Cloud9Env2', {
  vpc: defaultVpc,
  instanceType: new ec2.InstanceType('t3.large'),
  imageId: cloud9.ImageId.UBUNTU_18_04,
});

Cloning Repositories

Use clonedRepositories to clone one or multiple AWS Codecommit repositories into the environment:

import * as codecommit from 'aws-cdk-lib/aws-codecommit';

// create a codecommit repository to clone into the cloud9 environment
const repoNew = new codecommit.Repository(this, 'RepoNew', {
  repositoryName: 'new-repo',
});

// import an existing codecommit repository to clone into the cloud9 environment
const repoExisting = codecommit.Repository.fromRepositoryName(this, 'RepoExisting', 'existing-repo');

// create a new Cloud9 environment and clone the two repositories
declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
  vpc,
  clonedRepositories: [
    cloud9.CloneRepository.fromCodeCommit(repoNew, '/src/new-repo'),
    cloud9.CloneRepository.fromCodeCommit(repoExisting, '/src/existing-repo'),
  ],
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
});

Specifying Owners

Every Cloud9 Environment has an owner. An owner has full control over the environment, and can invite additional members to the environment for collaboration purposes. For more information, see Working with shared environments in AWS Cloud9).

By default, the owner will be the identity that creates the Environment, which is most likely your CloudFormation Execution Role when the Environment is created using CloudFormation. Provider a value for the owner property to assign a different owner, either a specific IAM User or the AWS Account Root User.

Owner is an IAM entity that owns a Cloud9 environment. Owner has their own access permissions, and resources. You can specify an Ownerin an EC2 environment which could be of the following types:

  1. Account Root
  2. IAM User
  3. IAM Federated User
  4. IAM Assumed Role

The ARN of the owner must satisfy the following regular expression: ^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):(iam|sts)::\d+:(root|(user\/[\w+=/:,.@-]{1,64}|federated-user\/[\w+=/:,.@-]{2,32}|assumed-role\/[\w+=:,.@-]{1,64}\/[\w+=,.@-]{1,64}))$

Note: Using the account root user is not recommended, see environment sharing best practices.

To specify the AWS Account Root User as the environment owner, use Owner.accountRoot()

declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
  vpc,
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
  owner: cloud9.Owner.accountRoot('111111111')
})

To specify a specific IAM User as the environment owner, use Owner.user(). The user should have the AWSCloud9Administrator managed policy

The user should have the AWSCloud9User (preferred) or AWSCloud9Administrator managed policy attached.

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)
})

To specify a specific IAM Federated User as the environment owner, use Owner.federatedUser(accountId, userName).

The user should have the AWSCloud9User (preferred) or AWSCloud9Administrator managed policy attached.

import * as iam from 'aws-cdk-lib/aws-iam';

declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
  vpc,
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
  owner: cloud9.Owner.federatedUser(Stack.of(this).account, "Admin/johndoe")
})

To specify an IAM Assumed Role as the environment owner, use Owner.assumedRole(accountId: string, roleName: string).

The role should have the AWSCloud9User (preferred) or AWSCloud9Administrator managed policy attached.

import * as iam from 'aws-cdk-lib/aws-iam';

declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
  vpc,
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
  owner: cloud9.Owner.assumedRole(Stack.of(this).account, "Admin/johndoe-role")
})

Auto-Hibernation

A Cloud9 environment can automatically start and stop the associated EC2 instance to reduce costs.

Use automaticStop to specify the number of minutes until the running instance is shut down after the environment was last used.

const defaultVpc = ec2.Vpc.fromLookup(this, 'DefaultVPC', { isDefault: true });
new cloud9.Ec2Environment(this, 'Cloud9Env2', {
  vpc: defaultVpc,
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
  automaticStop: Duration.minutes(30),
});