- Implementing Cloud Design Patterns for AWS(Second Edition)
- Sean Keery Clive Harber Marcus Young
- 135字
- 2021-06-24 15:11:50
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.
推薦閱讀
- 嵌入式Linux開發技術
- 深入Linux內核架構與底層原理(第2版)
- Linux使用和管理指南:從云原生到可觀測性
- VMware NSX Cookbook
- 注冊表應用完全DIY
- Red Hat Enterprise Linux 6.4網絡操作系統詳解
- Introduction to R for Quantitative Finance
- Windows 7實戰從入門到精通(超值版)
- Learn SwiftUI
- Learning Continuous Integration with Jenkins(Second Edition)
- Linux內核修煉之道
- Getting Started with Raspberry Pi Zero
- Mastering AWS CloudFormation
- 龍芯電腦使用解析(統信 UOS版)
- Red Hat Enterprise Linux 6.0系統管理