aws-cdk.aws-cloud9-alpha


Nameaws-cdk.aws-cloud9-alpha JSON
Version 2.170.0a0 PyPI version JSON
download
home_pagehttps://github.com/aws/aws-cdk
SummaryThe CDK Construct Library for AWS::Cloud9
upload_time2024-11-22 04:42:15
maintainerNone
docs_urlNone
authorAmazon Web Services
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AWS Cloud9 Construct Library

<!--BEGIN STABILITY BANNER-->---


![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> 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](https://semver.org/) 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.

---
<!--END STABILITY BANNER-->

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) 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`.

```python
# create a cloud9 ec2 environment in a new VPC
vpc = ec2.Vpc(self, "VPC", max_azs=3)
cloud9.Ec2Environment(self, "Cloud9Env", vpc=vpc, image_id=cloud9.ImageId.AMAZON_LINUX_2)

# or create the cloud9 environment in the default VPC with specific instanceType
default_vpc = ec2.Vpc.from_lookup(self, "DefaultVPC", is_default=True)
cloud9.Ec2Environment(self, "Cloud9Env2",
    vpc=default_vpc,
    instance_type=ec2.InstanceType("t3.large"),
    image_id=cloud9.ImageId.AMAZON_LINUX_2
)

# or specify in a different subnetSelection
c9env = cloud9.Ec2Environment(self, "Cloud9Env3",
    vpc=vpc,
    subnet_selection=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS
    ),
    image_id=cloud9.ImageId.AMAZON_LINUX_2
)

# print the Cloud9 IDE URL in the output
CfnOutput(self, "URL", value=c9env.ide_url)
```

## Specifying EC2 AMI

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

```python
default_vpc = ec2.Vpc.from_lookup(self, "DefaultVPC", is_default=True)
cloud9.Ec2Environment(self, "Cloud9Env2",
    vpc=default_vpc,
    instance_type=ec2.InstanceType("t3.large"),
    image_id=cloud9.ImageId.UBUNTU_18_04
)
```

## Cloning Repositories

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

```python
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
)
```

## 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](https://docs.aws.amazon.com/cloud9/latest/user-guide/share-environment.html)).

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 `Owner`in 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](https://docs.aws.amazon.com/cloud9/latest/user-guide/share-environment.html#share-environment-best-practices).

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

```python
# vpc: ec2.Vpc

cloud9.Ec2Environment(self, "C9Env",
    vpc=vpc,
    image_id=cloud9.ImageId.AMAZON_LINUX_2,
    owner=cloud9.Owner.account_root("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.

```python
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)
)
```

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.

```python
import aws_cdk.aws_iam as iam

# vpc: ec2.Vpc

cloud9.Ec2Environment(self, "C9Env",
    vpc=vpc,
    image_id=cloud9.ImageId.AMAZON_LINUX_2,
    owner=cloud9.Owner.federated_user(Stack.of(self).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.

```python
import aws_cdk.aws_iam as iam

# vpc: ec2.Vpc

cloud9.Ec2Environment(self, "C9Env",
    vpc=vpc,
    image_id=cloud9.ImageId.AMAZON_LINUX_2,
    owner=cloud9.Owner.assumed_role(Stack.of(self).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.

```python
default_vpc = ec2.Vpc.from_lookup(self, "DefaultVPC", is_default=True)
cloud9.Ec2Environment(self, "Cloud9Env2",
    vpc=default_vpc,
    image_id=cloud9.ImageId.AMAZON_LINUX_2,
    automatic_stop=Duration.minutes(30)
)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aws/aws-cdk",
    "name": "aws-cdk.aws-cloud9-alpha",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amazon Web Services",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7f/e4/1acbf425f5cb717beb316664ed71b9973b7b15b085fcaf2a2b9b146df1cf/aws_cdk_aws_cloud9_alpha-2.170.0a0.tar.gz",
    "platform": null,
    "description": "# AWS Cloud9 Construct Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n<!--END STABILITY BANNER-->\n\nThis module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.\n\nAWS Cloud9 is a cloud-based integrated development environment (IDE) that lets you write, run, and debug your code with just a\nbrowser. It includes a code editor, debugger, and terminal. Cloud9 comes prepackaged with essential tools for popular\nprogramming languages, including JavaScript, Python, PHP, and more, so you don\u2019t need to install files or configure your\ndevelopment machine to start new projects. Since your Cloud9 IDE is cloud-based, you can work on your projects from your\noffice, home, or anywhere using an internet-connected machine. Cloud9 also provides a seamless experience for developing\nserverless applications enabling you to easily define resources, debug, and switch between local and remote execution of\nserverless applications. With Cloud9, you can quickly share your development environment with your team, enabling you to pair\nprogram and track each other's inputs in real time.\n\n## Creating EC2 Environment\n\nEC2 Environments are defined with `Ec2Environment`. To create an EC2 environment in the private subnet, specify\n`subnetSelection` with private `subnetType`.\n\n```python\n# create a cloud9 ec2 environment in a new VPC\nvpc = ec2.Vpc(self, \"VPC\", max_azs=3)\ncloud9.Ec2Environment(self, \"Cloud9Env\", vpc=vpc, image_id=cloud9.ImageId.AMAZON_LINUX_2)\n\n# or create the cloud9 environment in the default VPC with specific instanceType\ndefault_vpc = ec2.Vpc.from_lookup(self, \"DefaultVPC\", is_default=True)\ncloud9.Ec2Environment(self, \"Cloud9Env2\",\n    vpc=default_vpc,\n    instance_type=ec2.InstanceType(\"t3.large\"),\n    image_id=cloud9.ImageId.AMAZON_LINUX_2\n)\n\n# or specify in a different subnetSelection\nc9env = cloud9.Ec2Environment(self, \"Cloud9Env3\",\n    vpc=vpc,\n    subnet_selection=ec2.SubnetSelection(\n        subnet_type=ec2.SubnetType.PRIVATE_WITH_EGRESS\n    ),\n    image_id=cloud9.ImageId.AMAZON_LINUX_2\n)\n\n# print the Cloud9 IDE URL in the output\nCfnOutput(self, \"URL\", value=c9env.ide_url)\n```\n\n## Specifying EC2 AMI\n\nUse `imageId` to specify the EC2 AMI image to be used:\n\n```python\ndefault_vpc = ec2.Vpc.from_lookup(self, \"DefaultVPC\", is_default=True)\ncloud9.Ec2Environment(self, \"Cloud9Env2\",\n    vpc=default_vpc,\n    instance_type=ec2.InstanceType(\"t3.large\"),\n    image_id=cloud9.ImageId.UBUNTU_18_04\n)\n```\n\n## Cloning Repositories\n\nUse `clonedRepositories` to clone one or multiple AWS Codecommit repositories into the environment:\n\n```python\nimport aws_cdk.aws_codecommit as codecommit\n\n# create a new Cloud9 environment and clone the two repositories\n# vpc: ec2.Vpc\n\n\n# create a codecommit repository to clone into the cloud9 environment\nrepo_new = codecommit.Repository(self, \"RepoNew\",\n    repository_name=\"new-repo\"\n)\n\n# import an existing codecommit repository to clone into the cloud9 environment\nrepo_existing = codecommit.Repository.from_repository_name(self, \"RepoExisting\", \"existing-repo\")\ncloud9.Ec2Environment(self, \"C9Env\",\n    vpc=vpc,\n    cloned_repositories=[\n        cloud9.CloneRepository.from_code_commit(repo_new, \"/src/new-repo\"),\n        cloud9.CloneRepository.from_code_commit(repo_existing, \"/src/existing-repo\")\n    ],\n    image_id=cloud9.ImageId.AMAZON_LINUX_2\n)\n```\n\n## Specifying Owners\n\nEvery 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](https://docs.aws.amazon.com/cloud9/latest/user-guide/share-environment.html)).\n\nBy 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.\n\n`Owner` is an IAM entity that owns a Cloud9 environment. `Owner` has their own access permissions, and resources. You can specify an `Owner`in an EC2 environment which could be of the following types:\n\n1. Account Root\n2. IAM User\n3. IAM Federated User\n4. IAM Assumed Role\n\nThe 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}))$`\n\nNote: Using the account root user is not recommended, see [environment sharing best practices](https://docs.aws.amazon.com/cloud9/latest/user-guide/share-environment.html#share-environment-best-practices).\n\nTo specify the AWS Account Root User as the environment owner, use `Owner.accountRoot()`\n\n```python\n# vpc: ec2.Vpc\n\ncloud9.Ec2Environment(self, \"C9Env\",\n    vpc=vpc,\n    image_id=cloud9.ImageId.AMAZON_LINUX_2,\n    owner=cloud9.Owner.account_root(\"111111111\")\n)\n```\n\nTo specify a specific IAM User as the environment owner, use `Owner.user()`. The user should have the `AWSCloud9Administrator` managed policy\n\nThe user should have the `AWSCloud9User` (preferred) or `AWSCloud9Administrator` managed policy attached.\n\n```python\nimport aws_cdk.aws_iam as iam\n# vpc: ec2.Vpc\n\n\nuser = iam.User(self, \"user\")\nuser.add_managed_policy(iam.ManagedPolicy.from_aws_managed_policy_name(\"AWSCloud9Administrator\"))\ncloud9.Ec2Environment(self, \"C9Env\",\n    vpc=vpc,\n    image_id=cloud9.ImageId.AMAZON_LINUX_2,\n\n    owner=cloud9.Owner.user(user)\n)\n```\n\nTo specify a specific IAM Federated User as the environment owner, use `Owner.federatedUser(accountId, userName)`.\n\nThe user should have the `AWSCloud9User` (preferred) or `AWSCloud9Administrator` managed policy attached.\n\n```python\nimport aws_cdk.aws_iam as iam\n\n# vpc: ec2.Vpc\n\ncloud9.Ec2Environment(self, \"C9Env\",\n    vpc=vpc,\n    image_id=cloud9.ImageId.AMAZON_LINUX_2,\n    owner=cloud9.Owner.federated_user(Stack.of(self).account, \"Admin/johndoe\")\n)\n```\n\nTo specify an IAM Assumed Role as the environment owner, use `Owner.assumedRole(accountId: string, roleName: string)`.\n\nThe role should have the `AWSCloud9User` (preferred) or `AWSCloud9Administrator` managed policy attached.\n\n```python\nimport aws_cdk.aws_iam as iam\n\n# vpc: ec2.Vpc\n\ncloud9.Ec2Environment(self, \"C9Env\",\n    vpc=vpc,\n    image_id=cloud9.ImageId.AMAZON_LINUX_2,\n    owner=cloud9.Owner.assumed_role(Stack.of(self).account, \"Admin/johndoe-role\")\n)\n```\n\n## Auto-Hibernation\n\nA Cloud9 environment can automatically start and stop the associated EC2 instance to reduce costs.\n\nUse `automaticStop` to specify the number of minutes until the running instance is shut down after the environment was last used.\n\n```python\ndefault_vpc = ec2.Vpc.from_lookup(self, \"DefaultVPC\", is_default=True)\ncloud9.Ec2Environment(self, \"Cloud9Env2\",\n    vpc=default_vpc,\n    image_id=cloud9.ImageId.AMAZON_LINUX_2,\n    automatic_stop=Duration.minutes(30)\n)\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "The CDK Construct Library for AWS::Cloud9",
    "version": "2.170.0a0",
    "project_urls": {
        "Homepage": "https://github.com/aws/aws-cdk",
        "Source": "https://github.com/aws/aws-cdk.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51d04b1e7dd385489240cc9af6e9452634624244d54cd65c945e11e14f871a6c",
                "md5": "a324b13a218cfe22588a2d34dd58b16b",
                "sha256": "cfd7ba01ed13555f49e77ec4a65819e151c4e3664b9a3e0cb75c2ca505a69dac"
            },
            "downloads": -1,
            "filename": "aws_cdk.aws_cloud9_alpha-2.170.0a0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a324b13a218cfe22588a2d34dd58b16b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 55310,
            "upload_time": "2024-11-22T04:41:24",
            "upload_time_iso_8601": "2024-11-22T04:41:24.722006Z",
            "url": "https://files.pythonhosted.org/packages/51/d0/4b1e7dd385489240cc9af6e9452634624244d54cd65c945e11e14f871a6c/aws_cdk.aws_cloud9_alpha-2.170.0a0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7fe41acbf425f5cb717beb316664ed71b9973b7b15b085fcaf2a2b9b146df1cf",
                "md5": "ea6ba91f3ec405886ab1a634d3b78d32",
                "sha256": "5aa8fd2e324c93669c76a3aea3fc07ac5e98ba664f01df70cfec4f22cf949e30"
            },
            "downloads": -1,
            "filename": "aws_cdk_aws_cloud9_alpha-2.170.0a0.tar.gz",
            "has_sig": false,
            "md5_digest": "ea6ba91f3ec405886ab1a634d3b78d32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 57217,
            "upload_time": "2024-11-22T04:42:15",
            "upload_time_iso_8601": "2024-11-22T04:42:15.927097Z",
            "url": "https://files.pythonhosted.org/packages/7f/e4/1acbf425f5cb717beb316664ed71b9973b7b15b085fcaf2a2b9b146df1cf/aws_cdk_aws_cloud9_alpha-2.170.0a0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-22 04:42:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aws",
    "github_project": "aws-cdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-cdk.aws-cloud9-alpha"
}
        
Elapsed time: 0.54383s