Deploy resources in AWS quickly using AWS CloudFormation
Cloud Formation is an infrastructure-as-code (IaC) product, where it allows developers and systems administrators with an easy way to create and manage a collection of related AWS resources, provisioning and updating them in an orderly and predictable fashion .It make use of codes or templates to define infrastructure in order to create, modify and delete. It avoids replication and allows creating or configuring infrastructure directly and gets updated.
How Does it work ?
Templates — JSON or YAML files which represent collections of resources grouped and managed together.
Stacks — the result of applying a template in a region within an AWS account. A stack represents a collection of Logical Resources and it manages the creation, update and deletion of those resources.
Logical Resources — a template and stack contain one or more logical resources. Logical resources have Logical Resource Names (unique in the template and stack), properties (inputs) and attributes (outputs). A logical resource maps one-2-one onto a physical resource.
Physical Resources — the actual AWS resource, an S3 bucket, an EC2 instance, an IAM policy to name but a few.
CloudFormation allows you to to create,update or delete the AWS infrastructure. Using CF you can automate any service on AWS by writing the CF templates.
Manual Infra Drawbacks:
- High cost(manpower and time)
- Low Quality(Failure and outages during updating of services)
- Low Flexibility(Changing Infra is difficult and generally avoided)
Automation with CF:
- Speed up the process
- Easy to perform test(testing Infra like testing the software)
- Documentation(Code Document how to manage Infra)
- AWS API helps is to achieve this.
- Use amazon AWS API’s for everything.
—-In CF we made a blueprint of the Infrastructure and write the blueprint in a JSON file.
—-Once we our JSON is at place we give this JSON to the CF and CF will run and create the Stack of resources for us.
—-It automatically resolve the dependencies and state.
—-One Template can be used to create multiple stacks of the Infrastructure Services(Production,Testing,Staging).