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

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.

主站蜘蛛池模板: 中江县| 中宁县| 千阳县| 和平区| 镇雄县| 凤庆县| 临沂市| 迭部县| 余干县| 新蔡县| 乐亭县| 峨眉山市| 休宁县| 昌黎县| 铁岭市| 定日县| 闵行区| 青川县| 清镇市| 卓资县| 湖南省| 宝清县| 淮滨县| 博乐市| 铁力市| 淄博市| 鹤峰县| 察雅县| 宣恩县| 邹平县| 文登市| 天门市| 临武县| 南昌县| 杭锦后旗| 城固县| 南宫市| 同江市| 呼伦贝尔市| 鹤壁市| 大同市|