Infrastructure as Code
- Infrastructure as Code (IaC) is a way to provision and manage your infrastructure through code instead of through manual processes
- With IaC, you can create configuration files that contain your infrastructure specifications, which makes it easier to edit and distribute configurations.
- You provision the same environment every time in other account or region
- That code would be deployed and create/update/delete our infrastructure
- Version control is an important part of IaC, and your configuration files should be under source control just like any other software source code file.
What is CloudFormation
- You can use AWS CloudFormation to create AWS resources in an orderly and predictable fashion.
- Resources are written in text files using JSON or YAML format.
- The templates require a specific syntax and structure that depends on the types of resources being created and managed.
- A CloudFormation template is deployed into the AWS environment as a stack
- For example, within a CloudFormation template, you can create a set of:
- One security group
- Two EC2 instance using this security group
- One S3 bucket
- One load balancer (ELB) in front of these EC2
CloudFormation Concept
- When you use AWS CloudFormation, you work with templates and stacks
- Topics
- Templates
- Stacks
- Change sets
- Templates
- A CloudFormation template is a JSON or YAML formatted text file
- CloudFormation uses these templates as blueprints for building your AWS resources
- Stacks
- When you use CloudFormation, you manage related resources as a single unit called a stack.
- You create, update, and delete a collection of resources by creating, updating, and deleting stacks.
- Change sets
- If you need to make changes to the running resources in a stack, you update the stack.
- Before making changes to your resources, you can generate a change set, which is a summary of your proposed changes.
- Change sets allow you to see how your changes might impact your running resources, especially for critical resources, before implementing them.
AWS CloudFormation