Home > Enterprise >  What is the difference between Rules vs Conditions in AWS cloudformation?
What is the difference between Rules vs Conditions in AWS cloudformation?

Time:09-20

I am new to cloudformation and trying to understand the diff between conditions and the rules in cloudformatiom any help please?

So far from my learning I have understood that Rules are like firewall, it will check if parameters (more than 1 parameter) are in state of combination as expected before proceeding with resource creation. If not AssertDescription will be displayed and stack creation will be stopped.

Can't this same be achieved through conditions (except display message) ? If so, why we need rules?

CodePudding user response:

Rules are used to enforce parameters having certain values. If the values defined by the rules are not respected, then the rules prevents the deployment of the CloudFormation template. Rules are evaluated pre-deployment.

Conditions on the other hand are used to conditionally create certain CloudFormation entities (e.g. a resource, or an output) depending on whether a condition is true or not (e.g. a property of a resource has a certain value). Conditions are evaluated during deployment.

  • Related