AWS CloudFormation: Difference between revisions
(Created page with "==Purpose== It is a recommended best practise in AWS to create a CloudFormation stack for each application per environment or even single instances. Reason include self-docum...") |
|||
Line 29: | Line 29: | ||
==Tools and generators== | ==Tools and generators== | ||
*AWS CloudFormation Designer - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/working-with-templates-cfn-designer.html | |||
*Troposphere - See page [[Troposphere]]. | *Troposphere - See page [[Troposphere]]. | ||
*Cumulus. Helps manage AWS CloudFormation stacks - https://github.com/cotdsa/cumulus | *Cumulus. Helps manage AWS CloudFormation stacks - https://github.com/cotdsa/cumulus |
Latest revision as of 19:40, 29 March 2017
Purpose
It is a recommended best practise in AWS to create a CloudFormation stack for each application per environment or even single instances. Reason include self-documenting and repeatability for those new to the its purpose and design but also allow more thorough inventory of resources by processing stacks. CloudFormation allows upfront architecture review prior to implementation.
The service itself has no costs other than that the stack are stored in S3 but those costs are minimal.
Caveats
Multi-accounts: Currently resources outside the account in which the stacks are created (such as Route 53 in another account) are not accessible in CloudFormation.
All resources referenced in a stack will be deleted when the stack is deleted including a shared resource with other applications. Care should be taken to either using a separate stack for shared resources or reference the entire shared applications as one stack.
Summary
CloudFormation has two parts: templates and stacks. A template is a JavaScript Object Notation (JSON) text file. The file, which is declarative and not scripted, defines what AWS resources or non-AWS resources are required to run the application. For example, the template may declare that the application requires an Amazon Elastic Compute Cloud (EC2) instance and an Identity and Access Management (IAM) policy.
When the template is submitted to the service, CloudFormation creates the necessary resources in the AWS account and builds a running instance of the template, putting dependencies and data flows in the right order automatically. The running instance and collection of resources used by it is referred to as a stack.
Changes to the stack can be made after it’s been deployed by using CloudFormation tools and an editing process that is similar to version control. When a stack is deleted, all related resources are deleted automatically as well.
Notes on CloudFormation
See page Kevin's AWS CloudFormation Notes.
AWS Class on Adv Ops course
See page AWS Class: AWS Advanced Operations
Tools and generators
- AWS CloudFormation Designer - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/working-with-templates-cfn-designer.html
- Troposphere - See page Troposphere.
- Cumulus. Helps manage AWS CloudFormation stacks - https://github.com/cotdsa/cumulus
- Updating a stack. When to update? When to make a new stack. - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html
- Nesting stacks - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html, https://blogs.aws.amazon.com/application-management/post/Tx1T9JYQOS8AB9I/Use-Nested-Stacks-to-Create-Reusable-Templates-and-Support-Role-Specialization and http://cloudacademy.com/blog/understanding-nested-cloudformation-stacks/
- Eclipse - https://java.awsblog.com/post/Tx1V52C59HQD149/Working-with-AWS-CloudFormation-in-Eclipse
- Packer - http://www.packer.io/intro
- Terraform - https://www.terraform.io/ and https://github.com/hashicorp/terraform
Documentation and tutorials
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-whatis-concepts.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
https://aws.amazon.com/cloudformation/faqs/
Samples
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-sample-templates-us-east-1.html