Skip to content

Instantly share code, notes, and snippets.

@jeromecovington
Last active September 11, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromecovington/83192fc26039a23f116e65ce9182dc40 to your computer and use it in GitHub Desktop.
Save jeromecovington/83192fc26039a23f116e65ce9182dc40 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: "version date"
" String
Description:
" template metadata
" arbitrary yaml
" CloudFormation helper scripts
" cfn-init, cfn-signal, cfn-get-metadata, cfn-hup
" Resources can have Metadata (install scripts, etc.)
Metadata:
" set of parameters
Parameters:
KeyName:
Description:
Type: " one of String, Number, List<Number>, CommaDelimitedList,
" or AWS specific parameter types AWS::EC2::AvailabilityZone::Name,
" AWS::EC2::Image::Id, AWS::EC2::Instance::Id, AWS::EC2::KeyPair::KeyName
ConstraintDescription:
" Parameter referenced using function, e.g.
" Parameters:
" InstanceType: ...
" Resources:
" WebServer:
" Type: AWS::EC2::Instance
" Properties:
" InstanceType: !Ref InstanceType
" set of mappings - maps keys to values
" Names must be alphanumeric. Values can be string or list types.
Mappings:
" example
" Mapping01:
" Key01:
" Name: Value01
" Key02:
" Name: Value02
" Key03:
" Name: Value03
RegionMap:
us-east-1:
HVM64: ami-...
HVMG2: ami-...
us-west-1:
HVM64: ami-...
HVMG2: ami-...
eu-west-1:
HVM64: ami-...
HVMG2: ami-...
" FindInMap usage - access values within a mapping collection.
" Requires a mapping colleciton, key, and name value.
" !FindInMap [mapping, key, name]
" example
" Resources:
" WebServer:
" Type: AWS::EC2::Instance
" Properties:
" ImageId: !FindInMap [RegionMap, !Ref "AWS::Region", HVM64]
" or
" ImageId: !FindInMap
" - RegionMap
" - !Ref "AWS::Region"
" - HVM64
" set of conditions
Conditions:
" example
" Resources:
" Database
" Type: AWS::RDS::DBInstance
" AllocatedStorage: !If [ProductionEnvironment, "800", "100"]
" set of transforms
Transform:
" set of resources
Resources:
" set of outputs
Outputs:
" example
" Resources
" InstanceStack:
" Type: AWS::CloudFormation::Stack
" Properties:
" TemplateURL: "https://.../...yml"
" Parameters:
" ProjectName: !Ref ProjectName
" Environment: !Ref Environment
" Changelog: !Ref Changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment