- Effective DevOps with AWS
- Nathaniel Felsen
- 375字
- 2021-07-15 17:11:53
Getting started with CloudFormation
As you would expect, you can access CloudFormation via the AWS console (https://console.aws.amazon.com/cloudformation) or by using the command line:
$ aws cloudformation help # for the list of options
The service is organized around the concept of stacks. Each stack typically describes a set of AWS resources and their configurations in order to start an application. When working with CloudFormation, most of your time is spent editing those templates.
There are different ways to get started with the actual editing of the templates. One of the easiest ways is to edit existing templates. AWS has a number of well-written examples available at http://amzn.to/27cHmrb.
At the highest level, templates are structured as follows:
{ "AWSTemplateFormatVersion" : "version date", "Description" : "Description string", "Resources" : { }, "Parameters" : { }, "Mappings" : { }, "Conditions" : { }, "Metadata" : { }, "Outputs" : { } }
AWSTemplateFormatVersion is currently always 2010-09-09 and represents the version of the template language used. The Description is for you to summarize what the template does. The Resources section describes which AWS services that will be instantiated and what their configurations are. When you launch a template, you have the ability to provide some extra information to CloudFormation such as which ssh key pair to use, for example, if you want to give SSH access to your EC2 instances. This kind of information goes into the Parameters section. The Mappings section is useful when you try to create a more generic template.
You can, for example, define which AMI to use for a given region so that the same template can be used to start an application in any AWS region. The Conditions section allows you to add conditional logic to your other sections (if statements, logical operators, and so on). The Metadata section lets you add more arbitrary information to your resources. Finally, the Outputs section lets you extract and print out useful information based on the execution of your template, such as the IP address of the EC2 server created, for example.
In addition to those examples, AWS also provides a couple of tools and services around CloudFormation template creation.
The first tool you can use to create your templates is called CloudFormation Designer.
- Instant Node Package Manager
- 程序員面試白皮書
- Spring Boot開發與測試實戰
- Three.js開發指南:基于WebGL和HTML5在網頁上渲染3D圖形和動畫(原書第3版)
- Android Application Development Cookbook(Second Edition)
- 羅克韋爾ControlLogix系統應用技術
- PHP+MySQL網站開發技術項目式教程(第2版)
- C語言程序設計
- Mastering Scientific Computing with R
- Oracle數據庫從入門到運維實戰
- 微信小程序開發解析
- Python深度學習:基于TensorFlow
- 機器學習與R語言實戰
- 運維前線:一線運維專家的運維方法、技巧與實踐
- 編程改變生活:用Python提升你的能力(進階篇·微課視頻版)