- 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.
推薦閱讀
- Learning OpenDaylight
- Linux Mint Essentials
- 大學計算機應用基礎實踐教程(Windows 7+Office 2013)
- Google系統架構解密:構建安全可靠的系統
- 阿里云數字新基建系列:云原生操作系統Kubernetes
- Dreamweaver CS5.5 Mobile and Web Development with HTML5,CSS3,and jQuery
- 完美應用RHEL 8
- Advanced TypeScript Programming Projects
- 從零開始學安裝與重裝系統
- Web Penetration Testing with Kali Linux(Third Edition)
- Linux內核分析及應用
- Azure Serverless Computing Cookbook
- Windows7系統維護百寶箱
- Linux指令從入門到精通(“十二五”國家重點圖書出版規劃項目)
- 精通Linux內核:智能設備開發核心技術