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

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.

主站蜘蛛池模板: 错那县| 杭锦旗| 梁河县| 广元市| 大名县| 阳江市| 广水市| 砚山县| 闽清县| 井陉县| 色达县| 宁河县| 赤壁市| 石林| 佛冈县| 江达县| 华亭县| 武清区| 安陆市| 塔河县| 五原县| 苏州市| 南平市| 无极县| 呼图壁县| 泾源县| 绵竹市| 冷水江市| 海阳市| 大冶市| 黄浦区| 达州市| 久治县| 石城县| 苏尼特右旗| 宣化县| 获嘉县| 阿拉善右旗| 县级市| 克什克腾旗| 凤凰县|