This project provides a Terraform configuration to provision multiple AWS Cloud9 environments effortlessly. AWS Cloud9 is a cloud-based integrated development environment (IDE) that provides a convenient way to write, run, and debug code in various programming languages. With this Terraform setup, you can easily create and manage multiple Cloud9 environments for your development, testing, or collaborative needs.
Be careful how you store your tfstate
file as there will be passwords stored. It will not be displayed in the console as it is set as sensitive
but still it will be there.
Before using this project, ensure you have the following prerequisites:
- An AWS account with the necessary permissions.
- AWS CLI configured on your local machine with access and secret keys.
- Terraform installed on your local machine. You can download it from here.
- Basic familiarity with Terraform and AWS Cloud9.
- Clone this repository to your local machine.
git clone https://github.com/crispy-tk/aws-cloud9-multi-env.git
- Change into the project directory.
cd aws-cloud9-multi-env
-
Create a
terraform.tfvars
file to customize your project. You can adjust parameters such as theinstance_type
,members_list
, and more. -
Initialize the Terraform configuration.
terraform init
- Review the Terraform execution plan to ensure everything is as expected.
terraform plan
- Apply the configuration to create your Cloud9 environments.
terraform apply
-
Confirm the execution by typing "yes" when prompted.
-
Terraform will create the Cloud9 environments according to your specifications.
To customize your Cloud9 environments, update the terraform.tfvars file with your desired configurations, including but not limited to:
region
: The region where the Cloud9 will be provisioned.instance_type
: The EC2 instance type to use.project
: The name of your Cloud9 environment. It will be composed of theproject
parameter and a name from thenew_members
andexisting_members
parameter.new_members
: A list of usernames to associate with the Cloud9 environment. The list of names will be used to create new IAM Users and assign to a Cloud IDE.existing_members
: A list of exinting users to associate with the Cloud9 environment. The list of names will be used to assign to a Cloud IDE.
Example of Cloud9 environment naming.
myproject-username-{randomID}
You can refer to the AWS Cloud9 documentation for more configuration options.
Example of terraform.tfvars
file.
project = "project-name"
profile = "yourawsprofile"
members_list = ["member01", "member02"]
- Run the following command in the Terminal to retrieve the users passwords.
$ terraform output password
-
Access the AWS Console using the brand new users and passwords.
-
Open the Cloud9 URL.
When you no longer need a Cloud9 environment, you can destroy it with Terraform. Run the following command to destroy all the resources:
terraform destroy
.
├── docs
├── generate-readme.sh
├── images
│ ├── cloud9ui.png
│ └── tf_aws.png
├── LICENSE
├── main.tf
├── provider.tf
├── README.md
└── variables.tf
3 directories, 13 files
Name | Version |
---|---|
aws | 5.22.0 |
random | 3.5.1 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
existing_members | Add existing users to membership. The number of members will determine the number of instances. | list(string) |
n/a | yes |
new_members | Add new users to membership. The number of members will determine the number of instances. | list(string) |
n/a | yes |
instance_type | Define instance type. | string |
"t2.micro" |
no |
members_permissions | Permissions are: read-only OR read-write . |
string |
"read-write" |
no |
profile | Set your AWS CLI profile. | string |
"default" |
no |
project | Set your cloud9 project name. | string |
"example" |
no |
region | Define the provisioned region. | string |
"us-east-1" |
no |
Name | Description |
---|---|
cloud9_url | Return URL to access the environment |
password | Return user(s) profile(s) password(s) for console access. |
Name | Type |
---|---|
aws_cloud9_environment_ec2.cloud9_instance | resource |
aws_cloud9_environment_membership.existing_user_membership | resource |
aws_cloud9_environment_membership.new_user_membership | resource |
aws_iam_user.new_user | resource |
aws_iam_user_login_profile.profile | resource |
aws_iam_user_policy_attachment.policy_attach_existing | resource |
aws_iam_user_policy_attachment.policy_attach_new | resource |
random_id.env | resource |
aws_iam_policy.cloud9 | data source |
aws_iam_user.existing_user | data source |
Contributions to this project are welcome. If you have any suggestions, bug fixes, or improvements, please open an issue in this repository.
This project is licensed under the MIT License. See the LICENSE file for more details.