What is CloudFormation? “...an easy way to create and manage a collection of related AWS resources, provisioning and updating them in an orderly and predictable fashion.” https://aws.amazon.com/cloudformation/
Nested stacks — CloudFormation invokes child templates — Atomic execution — One fails, all fail — Pass parameters through "references" — Need to pass parameters for child template "through" the parent
Partitioning — Keep templates simple — Reuse parameters and mappings via a DSL — Choose vertical or horizontal scaling — Decide if you want to rollback the stack or not
The dreaded _FAILED states — Resolve manually — Console will give you indication of which resource failed to update — Delete offending resource or its dependencies manually — Run delete stack again — When in real shit, call support
Creating the templates — Use CloudFormer to instrospect your VPC. — http://docs.aws.amazon.com/AWSCloudFormation/ latest/UserGuide/cfn-using-cloudformer.html — http://aws.amazon.com/developertools/ 6460180344805680 — Uses a Micro instance inside your VPC to interrogate and dumps results to S3 — Parse with the ruby cloudformation-ruby-
Incorporating templates — Resources must be provisioned by CloudFormation — Use a phased approach. Use Ref to refer to existing resources, passed as parameters. — Usually in reverse of your pipeline — machines first, VPCs last — e.g. "VpcId" : { "Ref" : "VpcId" }
Policies — Use DependsOn and WaitConditions to control dependency creation — Use UpdatePolicy for ASG changes. — Use DeletionPolicy to ensure are not deleted by CloudFormation (instance termination protection on steroids) — Note the Update requires property in the documentation
Other — Test deploys in a sandbox environment that mirrors production. Smaller resource types can help reduce costs. — Parameterise everything. — Use the http://docs.aws.amazon.com/ AWSCloudFormation/latest/UserGuide/template- reference.html