- AWS Administration Cookbook
- Lucas Chan Rowan Udell
- 107字
- 2021-07-09 18:18:26
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
推薦閱讀
- 大學(xué)計(jì)算機(jī)基礎(chǔ):基礎(chǔ)理論篇
- LabVIEW虛擬儀器從入門(mén)到測(cè)控應(yīng)用130例
- 程序設(shè)計(jì)缺陷分析與實(shí)踐
- Blockchain Quick Start Guide
- 嵌入式Linux上的C語(yǔ)言編程實(shí)踐
- JMAG電機(jī)電磁仿真分析與實(shí)例解析
- INSTANT Drools Starter
- 單片機(jī)技能與實(shí)訓(xùn)
- 電子設(shè)備及系統(tǒng)人機(jī)工程設(shè)計(jì)(第2版)
- 機(jī)床電氣控制與PLC
- Machine Learning in Java
- JSP通用范例開(kāi)發(fā)金典
- 工廠電氣控制設(shè)備
- 暗戰(zhàn)強(qiáng)人:黑客攻防入門(mén)全程圖解
- 數(shù)據(jù)庫(kù)技術(shù):Access 2003計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)