- 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
推薦閱讀
- 大數據管理系統
- 大數據技術基礎
- Mobile DevOps
- Hands-On Neural Networks with Keras
- 西門子S7-200 SMART PLC實例指導學與用
- 水晶石精粹:3ds max & ZBrush三維數字靜幀藝術
- Kubernetes for Developers
- Dreamweaver CS6精彩網頁制作與網站建設
- 空間機械臂建模、規劃與控制
- Linux嵌入式系統開發
- Visual C++項目開發案例精粹
- Spatial Analytics with ArcGIS
- 電子設備及系統人機工程設計(第2版)
- IBM? SmartCloud? Essentials
- ASP.NET 2.0 Web開發入門指南