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

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.

主站蜘蛛池模板: 新巴尔虎左旗| 都昌县| 通城县| 滁州市| 天祝| 望城县| 东丽区| 进贤县| 南投市| 汤原县| 横峰县| 韶关市| 双江| 建德市| 曲阜市| 恩平市| 德格县| 庆阳市| 安丘市| 胶州市| 辽宁省| 仲巴县| 连平县| 古田县| 莫力| 富顺县| 宾阳县| 儋州市| 胶南市| 靖宇县| 故城县| 禹城市| 贵南县| 宁都县| 会理县| 汾阳市| 美姑县| 伊宁县| 惠东县| 高雄县| 建阳市|