-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cloud9): support setting environment owner #23878
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2a47f13
added property and unit test
pattasai 43ded09
owner_props
pattasai 85e85a7
support setting environment owner
pattasai c52b45e
support setting environment owner
pattasai a695cd5
support setting environment owner
pattasai beaf73c
fix readme error
pattasai 4f014c1
fix readme
pattasai a4c5e8e
Merge branch 'main' into pattasai/add-owner-prop
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,19 +23,19 @@ | |||||
|
||||||
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 | ||||||
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 | ||||||
EC2 Environments are defined with `Ec2Environment`. To create an EC2 environment in the private subnet, specify | ||||||
`subnetSelection` with private `subnetType`. | ||||||
|
||||||
|
||||||
|
@@ -52,7 +52,7 @@ new cloud9.Ec2Environment(this, 'Cloud9Env2', { | |||||
imageId: cloud9.ImageId.AMAZON_LINUX_2, | ||||||
}); | ||||||
|
||||||
// or specify in a different subnetSelection | ||||||
// or specify in a different subnetSelection | ||||||
const c9env = new cloud9.Ec2Environment(this, 'Cloud9Env3', { | ||||||
vpc, | ||||||
subnetSelection: { | ||||||
|
@@ -104,3 +104,39 @@ new cloud9.Ec2Environment(this, 'C9Env', { | |||||
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](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 a user that owns a Cloud9 environment . `Owner` has their own access permissions, resources. And we can specify an `Owner`in an Ec2 environment which could be of two types, 1. AccountRoot and 2. Iam User. It allows AWS to determine who has permissions to manage the environment, either an IAM user or the account root user (but 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()` | ||||||
|
||||||
```ts | ||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here:
Suggested change
|
||||||
|
||||||
```ts | ||||||
import * as iam from '@aws-cdk/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) | ||||||
}) | ||||||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be a heading.