Creating and configuring your Cloud9 instance
We will use the following Terraform code to create a Cloud9 instance, allow the user defined within the myuser_arn
local to use it, and connect it to the subnet defined in subnet_id
. As we have defined the connection type as CONNECT_SSM
, this subnet can be private as long as it has connectivity to the AWS SSM API, either through a private endpoint or a NAT gateway:
data "aws_region" "current" {} locals { Â Â myuser_arn = "arn:aws:sts::123:myuser" } resource "aws_cloud9_environment_ec2" "k8sdev" { Â Â name = "k8sdev" Â Â instance_type = "t3.medium" Â Â connection_type = "CONNECT_SSM" Â Â description = "cloud9 K8s development environment" Â Â subnet_id = "subnet-123" Â Â owner_arn = local.myuser_arn } data "aws_instance" "cloud9_instance" { Â Â filter { ...