Day 9: AWS | CFT (CloudFormation Template)

Day 9: AWS | CFT (CloudFormation Template)

Introduction of CFT(CloudFormation Template)

  • AWS CloudFormation is a service provided by Amazon Web Services that enables users to model and manage infrastructure resources in an automated and secure manner.

  • Using CloudFormation, developers can define and provision AWS infrastructure resources using a JSON or YAML formatted Infrastructure as Code template.

What is the difference between AWS CLI and CFT?

  • AWS CFT implements the principal of IAC which CLI does not.

  • The CLI is more powerful and has finer grained control then CloudFormation.

  • CloudFormation makes it very easy to use yaml or json text files that can describe an entire enterprise in the cloud.

What is mean of IAC(Infrastructure as Code) ?

  • Infrastructure as Code (IaC) is the managing and provisioning of infrastructure through code instead of through manual processes.

  • With IaC, configuration files are created that contain your infrastructure specifications, which makes it easier to edit and distribute configurations.

  • 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.

  • Deploying your infrastructure as code also means that you can divide your inrastructure into modular components that can then be combined in different ways through automation.

What CFT does?

  • It acts as a middleman that follows the prinicpal of IAC.

  • User will give the input in YAML or JSON and CFT will take the input then CFT will convert the input in AWS API call.

  • CFT has to be declarative and versioned in nature.

When to use CFT and when CLI?

  • We should CLI when you want to perform some short/quick action.

  • We should use CFT when we want to create actual resources.

Feature of CFT?

  • It supports both JSON and YAML

  • CFT also support drift detection.

What is the meaning of Drift Detection?

  • Suppose today you have create one EC2 instance and S3 bucket using CFT and tomorrow other engineer come and and modify something in S3 bucket using GUI.

  • Once changes made at the same time you will be notify becuase of drift detection feature, that something has changed in your infrastructure that you created through CloudFormation. So that you can go there and fix the difference immediately.

What is stack in CFT?

  • Stack is the one which implemet the tempelate, when you write CloudFormation tempelate you have to submit that to stack.

  • Stack will convert your tempelate request to the AWS API using CloudFormation service.