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

A closer look at CloudFormation templates

CloudFormation templates consist of a number of parts, but these are the four we're going to concentrate on:

  • Parameters
  • Resources
  • Outputs
  • Mappings

Here's a short YAML example:

AWSTemplateFormatVersion: '2010-09-09' 
Parameters:
EC2KeyName:
Type: String
Description: EC2 Key Pair to launch with
Mappings:
RegionMap:
us-east-1:
AMIID: ami-9be6f38c
ap-southeast-2:
AMIID: ami-28cff44b
Resources:
ExampleEC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: t2.nano
UserData:
Fn::Base64:
Fn::Sub': |
#!/bin/bash -ex
/opt/aws/bin/cfn-signal '${ExampleWaitHandle}'
ImageId:
Fn::FindInMap: [ RegionMap, Ref: 'AWS::Region', AMIID ]
KeyName:
Ref: EC2KeyName
ExampleWaitHandle:
Type: AWS::CloudFormation::WaitConditionHandle
Properties:
ExampleWaitCondition:
Type: AWS::CloudFormation::WaitCondition
DependsOn: ExampleEC2Instance
Properties:
Handle:
Ref: ExampleWaitHandle
Timeout: 600
Outputs:
ExampleOutput:
Value:
Fn::GetAtt: ExampleWaitCondition.Data
Description: The data signaled with the WaitCondition
主站蜘蛛池模板: 新宁县| 冀州市| 东光县| 建水县| 揭阳市| 广水市| 鄂托克旗| 新源县| 工布江达县| 东乡族自治县| 古丈县| 香河县| 温泉县| 奇台县| 炎陵县| 平乡县| 崇义县| 安西县| 灯塔市| 寿宁县| 龙州县| 营口市| 阜城县| 林口县| 洛宁县| 卢氏县| 德庆县| 镇雄县| 迁安市| 保定市| 图木舒克市| 彭州市| 大新县| 济阳县| 上杭县| 余干县| 阜宁县| 鹿泉市| 阿克陶县| 贵阳市| 怀化市|