Resource: awsCloud9EnvironmentEc2
Provides a Cloud9 EC2 Development Environment.
Example Usage
Basic usage:
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloud9EnvironmentEc2.Cloud9EnvironmentEc2(this, "example", {
instanceType: "t2.micro",
name: "example-env",
});
Get the URL of the Cloud9 environment after creation:
import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloud9EnvironmentEc2Example =
new aws.cloud9EnvironmentEc2.Cloud9EnvironmentEc2(this, "example", {
instanceType: "t2.micro",
});
new aws.dataAwsInstance.DataAwsInstance(this, "cloud9_instance", {
filter: [
{
name: "tag:aws:cloud9:environment",
values: [awsCloud9EnvironmentEc2Example.id],
},
],
});
new cdktf.TerraformOutput(this, "cloud9_url", {
value: `https://\${var.region}.console.aws.amazon.com/cloud9/ide/\${${awsCloud9EnvironmentEc2Example.id}}`,
});
Allocate a static IP to the Cloud9 environment:
import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloud9EnvironmentEc2Example =
new aws.cloud9EnvironmentEc2.Cloud9EnvironmentEc2(this, "example", {
instanceType: "t2.micro",
});
const dataAwsInstanceCloud9Instance = new aws.dataAwsInstance.DataAwsInstance(
this,
"cloud9_instance",
{
filter: [
{
name: "tag:aws:cloud9:environment",
values: [awsCloud9EnvironmentEc2Example.id],
},
],
}
);
const awsEipCloud9Eip = new aws.eip.Eip(this, "cloud9_eip", {
instance: dataAwsInstanceCloud9Instance.id,
vpc: true,
});
new cdktf.TerraformOutput(this, "cloud9_public_ip", {
value: awsEipCloud9Eip.publicIp,
});
Argument Reference
The following arguments are supported:
name
- (Required) The name of the environment.instanceType
- (Required) The type of instance to connect to the environment, e.g.,t2Micro
.automaticStopTimeMinutes
- (Optional) The number of minutes until the running instance is shut down after the environment has last been used.connectionType
- (Optional) The connection type used for connecting to an Amazon EC2 environment. Valid values areCONNECT_SSH
andCONNECT_SSM
. For more information please refer AWS documentation for Cloud9.description
- (Optional) The description of the environment.imageId
- (Optional) The identifier for the Amazon Machine Image (AMI) that's used to create the EC2 instance. Valid values areamazonlinux1X8664
amazonlinux2X8664
ubuntu1804X8664
resolve:ssm:/aws/service/cloud9/amis/amazonlinux1X8664
resolve:ssm:/aws/service/cloud9/amis/amazonlinux2X8664
resolve:ssm:/aws/service/cloud9/amis/ubuntu1804X8664
ownerArn
- (Optional) The ARN of the environment owner. This can be ARN of any AWS IAM principal. Defaults to the environment's creator.subnetId
- (Optional) The ID of the subnet in Amazon VPC that AWS Cloud9 will use to communicate with the Amazon EC2 instance.tags
- (Optional) Key-value map of resource tags. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The ID of the environment.arn
- The ARN of the environment.tagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.type
- The type of the environment (e.g.,ssh
orec2
)