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

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.

主站蜘蛛池模板: 南昌市| 西贡区| 双牌县| 浦江县| 淳化县| 沛县| 休宁县| 宝坻区| 丘北县| 慈利县| 秦皇岛市| 和政县| 临泽县| 林西县| 丰城市| 沙河市| 合肥市| 孝义市| 江西省| 兴国县| 射洪县| 乌兰察布市| 武夷山市| 巴马| 阿克| 云安县| 武山县| 玉龙| 夏邑县| 锡林浩特市| 安岳县| 浦江县| 平潭县| 深泽县| 遂平县| 麻栗坡县| 曲靖市| 淄博市| 鄢陵县| 闽清县| 长海县|