Tuesday, December 1, 2020

AWS - CloudFormation

Cloud Formation is a service used to build your infrastructure(AWS resources) in an automated way with a script file across regions as well as for multiple accounts.


A Stack is a collection of AWS resources that you can manage as a single unit. In other words, you can create, update, or delete a collection of resources by creating, updating, or deleting stacks. All the resources in a stack are defined by the stack's AWS CloudFormation template.

You need to create a template that describes all the AWS resources that you want (like EC2 instances or Amazon RDS DB instances, S3 buckets), and AWS CloudFormation takes care of provisioning and configuring those resources for you.
You don't need to individually create and configure AWS resources and figure out what's dependent on what, AWS CloudFormation handles all of that.



You can write cloudFormation script in Json or YAML.


Points to be Remember
  1. By default automatic rollback feature is enabled.
  2. You are charged if errors occured while launching CloudFormation and its rollback.
  3. CloudFormation is free, you pay for resources you use like EC2, S3 buckets.
  4. Stacks can wait using "WaitCondition" for applications to be provisioned.
  5. Fn:GetAtt can be used to get output data like instance ip, ELB IP, S3 bucket name etc.
  6. Route53 supported for new as well as existing hosted zones.
  7. Aliases, 'A' record can be created (DNS settings)
  8. IAM creation an assignment supported

Benefits
  • Modelling Infrastructure 
AWS CloudFormation allows you to model your entire infrastructure in a text file. It helps you to standardize infrastructure components used across your organization, enabling configuration compliance and faster troubleshooting.

  • Quickly Replicate the infrastructure
AWS CloudFormation provisions your resources in a safe, repeatable manner, allowing you to build and rebuild your infrastructure and applications, without having to perform manual actions or write custom scripts. CloudFormation takes care of determining the right operations to perform when managing your stack, and rolls back changes automatically if errors are detected.

When you use AWS CloudFormation, you can reuse your template to set up your resources consistently and repeatedly. Just describe your resources once and then provision the same resources over and over in multiple regions.

  • Easily Control and Track Changes to Your Infrastructure
Whenever you need updates in AWS resources, like changing EC2 instance size or changing maximum no of instances.
If you do it by ClodFormation and face any error in execution of new script it rollbacks and restores previous one.

You source control CloudFormation text files, so you have track of changes in the file and you can restore check any previous versions as well.  

No comments:

Post a Comment

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...