Declarative programming describes the desired state of infrastructure without listing the actions or execution order required to create it. Imperative code instead gives step-by-step instructions and manages dependencies explicitly. section 4.3.4 section 4.5
AWS CloudFormation expresses the desired infrastructure in a JSON or YAML template. CloudFormation interprets that description, handles dependencies, and determines how to reach the declared state. section 4.5
Declarative infrastructure supports several practical goals:
- Consistency: teams use a common language instead of implementing infrastructure through unrelated scripts. section 4.5
- Reproducibility: matching templates can create equivalent test and production environments. section 4.5
- Customization and testing: parameters adapt templates, while temporary infrastructure can be created, tested, and removed. section 4.5
- Updatability: changing the declared configuration lets CloudFormation identify and apply the required infrastructure changes. section 4.5 section 4.5.3
Changing a virtual machine
Rather than scripting each action needed to replace or reconfigure a virtual machine, change the relevant CloudFormation parameter or template value. CloudFormation determines what must change to reach the new result, then updates the stack. section 4.5.3













