Amazon CloudFormation templates are a bit tricky to write, regardless of whether you are working on your first one or you have been doing it for years. Sure, there are plenty of examples online, tools that make it easier (thanks Ansible!), and copy-pasting sections from your own library. But any tips on how to make the life easier are always welcome.
Hence, here’s a very handy collection of “7 Awesome CloudFormation Hacks“. These include:
- Combine two sequent intrinsic functions
- Use exported values from other stacks in !Sub
- Changes in cfn-init don’t trigger redeployment in AutoScaling Group
- Get Stack name of sibling stack in nested stacks
- AccountIds with leading zero
- Use Dictionaries as Stack Parameter
- DependsOn with condition