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

  • Effective DevOps with AWS
  • Yogesh Raheja Giuseppe Borgese Nathaniel Felsen
  • 392字
  • 2021-07-23 16:27:31

Getting started with CloudFormation

As you would expect, you can access CloudFormation through the AWS console at https://console.aws.amazon.com/cloudformation, or by using the following 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 configuration 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", "Resources" : { }, 
"Parameters" : { }, 
"Mappings" : { }, 
"Conditions" : { }, 
"Metadata" : { }, 
"Outputs" : { } 
} 

The AWSTemplateFormatVersion section is currently always 2010-09-09 and this represents the version of the template language used. This version is currently the only valid value. The Description section is there for you to summarize what the template does. The Resources section describes which AWS services 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 Amazon Machine Image (AMI) to use for a given region, so that the same template can be used to start an application in that AWS region. The Conditions section allows you to add conditional logic to your other sections (if statements, logical operators, and so on), while 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.

主站蜘蛛池模板: 兴文县| 陕西省| 鹿泉市| 繁昌县| 太保市| 绿春县| 田阳县| 秦皇岛市| 吐鲁番市| 柘荣县| 阜康市| 兴城市| 琼海市| 广安市| 健康| 清苑县| 偃师市| 汝州市| 南漳县| 平南县| 三亚市| 南靖县| 靖远县| 行唐县| 台北县| 浏阳市| 综艺| 浠水县| 河池市| 当涂县| 定兴县| 拜城县| 罗山县| 平潭县| 蒙城县| 杨浦区| 汪清县| 云浮市| 资中县| 青田县| 南宫市|