Skip to content

Instantly share code, notes, and snippets.

@mgla
Last active September 11, 2018 13:21
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 mgla/8a658bb50202923d26675d51bedb20e4 to your computer and use it in GitHub Desktop.
Save mgla/8a658bb50202923d26675d51bedb20e4 to your computer and use it in GitHub Desktop.
So, you want start with AWS CloudFormation

So, you want start with AWS CloudFormation

About this document

These are some unsorted notes I am taking along my journey with AWS CloudFormation (CFN). I plan to collect some good practices here

Things to think of beforehand

While AWS can be used cost for cost-saving, it is not for the weak of wallet at first. If you just want to run a VM with a public IP, you probably won't benefit from AWS at all.

VPCs (subnetting)

  • Do you ever want to route to those subnets? If yes, pick a class B subnet to place your VPCs in.
  • For easier routing over DirectConnect or VPN, you might want to subdivide your more permanent VPCs by region.

Example:

ALL VPC in: 10.10/16 VPCs in eu-west-1 in 10.10.1/21 Prod VPCs in eu-west-1 in 10.10.1/22 Prod VPCs in eu-west-1 in 10.10.9/22

General design notes and warnings

  • Look into Route53 early on, preferably one of your first services. It can mitigate a lot of problems with AWS CFN early on, such as changing RDS Endpoints and changing ELB CNAMEs
  • Use Auto Scaling Groups wherever possible. Avoid Usage of ElasticIPs wherever possible.
  • Use exports wisely and include a parameter in your templates that allows you to prefix them. You can only export the same key once per account and region.
  • Free yourself of the notion that the CloudFormation Dashboard on the AWS console must be clean and well-aranged. Name your stacks in a structured manner and make yourself comfortable with the search function.

Avoid the master stack

Warnings

Route53

Never touch Route53 entries managed by CloudFormation with anything else. Any change may render CloudFormation unable to change the entry in any way, resulting in stacks unable to update at all, until the last status known to CloudFormation is restored.

Organisation

  • If you are providing infrastructure for others, emphasise early on, that EC2 instances can and will be be terminated at any time.

Links to Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment