官术网_书友最值得收藏!

Instances

EC2 is the instance level service offering. We already created an instance when we spun up our Cloud9 environment. Using Terraform, we can create another one very easily. Create the following example.tf file:

resource "aws_instance" "example" {
ami = "ami-2757f631"
instance_type = "t2.micro"
}
output "id" {
value = "${aws_instance.example.id}"
}

Run terraform apply. The output will be kept in your state file for future use:

We can easily destroy it with terraform destroy. If you like, you can try it now. Bringing the environments back is as simple as running terraform apply.

One thing to note about terraform destroy is that it can be unreliable in practice, especially if the environment is quite complicated. It pays to check that everything has been torn down successfully after the command has completed.

主站蜘蛛池模板: 通州区| 容城县| 泽州县| 武平县| 东莞市| 历史| 喀什市| 青铜峡市| 思茅市| 石门县| 赞皇县| 镇宁| 陕西省| 都匀市| 利川市| 丰城市| 晋州市| 白朗县| 文山县| 沽源县| 文昌市| 朝阳区| 胶州市| 宣汉县| 邢台市| 彭泽县| 独山县| 呼和浩特市| 贺州市| 叶城县| 高雄县| 乌兰浩特市| 建阳市| 沿河| 乌拉特前旗| 海城市| 曲沃县| 新乐市| 稻城县| 广宁县| 涟源市|