Topic lessonTopic: IaC and CloudFormation: configuration, changes and drift
Infrastructure as code explained: managing AWS configuration and changes
Infrastructure as code (IaC) expresses infrastructure configuration as code so changes can be reviewed and versioned. Saving a file does not itself change AWS. Follow a change through writing the configuration, reviewing the difference, applying it and checking the result.
Distinguish configuration, version history, provisioning and live resources; explain why inputs and target environments matter even with the same file.
AWS resources are objects you create or configure, such as VPCs and EC2 instances. Git tracks file history. No account creation or command execution is needed here.
Separate configuration, history, provisioning and resources
In CloudFormation, a template declares resource types and settings; a stack groups resources for management. Git history records file changes, while stack operation results describe what happened in AWS. They answer different questions.
| Role | What to inspect | What it does not establish |
|---|---|---|
| Configuration | Resource definitions, settings, references and inputs. | Whether it has been applied. |
| History and review | Reasons, differences and the reviewed revision. | Whether AWS currently matches it. |
| Provisioning | Target stack, inputs, permissions and operation results. | Whether every application function and its data are correct. |
| Live resources | Configuration, state, application behavior and costs. | Whether the rationale was recorded in the repository. |
Follow a change from authoring to verification
- Write configuration → Review differencesRecord changes
- Review differences → Apply changesDecide and execute
- Apply changes → Check resourcesVerify results
- Write configuration
- Resources, settings, inputs
- Review differences
- Reason, impact, target
- Apply changes
- A provisioning engine
- Check resources
- Settings, behavior, cost
The diagram shows work, not a network path. With CloudFormation, a change set previews proposed additions, changes and removals. Creating that preview and executing it are separate operations.
The same file can have different inputs and targets
A shared template can produce different outcomes with different parameters, referenced resources, accounts, Regions or permissions. Making a setup reproducible is different from guaranteeing identical results everywhere. Associate inputs and targets with the reviewed revision; keep secrets out of code and outputs.
| Check | Concrete question |
|---|---|
| Target | Production or test? Are the account, Region and stack correct? |
| Inputs | Which values change and which stay? Are secrets excluded from history? |
| Ownership | Which stack or process is responsible for changing this resource? |
| Impact | Could a change replace or delete resources, alter permissions or affect cost? |
Fixed example: changing 80 to 443 in Git
| Stage | What this example establishes |
|---|---|
| Edit | An illustrative connection setting changes from 80 to 443. |
| Record in Git | The edit is versioned; this is not evidence of an AWS deployment. |
| Review | Check the intended effect against the resource and related settings. |
| After a real deployment | Inspect operation results, endpoints, certificates, application configuration and behavior. |
History supports recovery; it does not restore all data
An earlier template helps you review configuration, but applying it may replace or delete resources. Treat configuration changes, data recovery and consumer cutover separately, and check the conditions for each.
This course starts with CloudFormation templates, change sets and drift. Other IaC tools exist; before comparing product names, learn to identify what is managed, what is compared and which operation changes real resources.
Check your understanding of the workflow
Choose an option to see the result and explanation.
Check, then explain in your own words
- Distinguish the four roles using the table.
- Explain why a Git edit and an AWS change are separate.
- Next, read resources and references in a template.
Check your understanding: Someone says “this infrastructure is managed in Git.” What else should you check?
Match the applied revision, inputs and target stack with provisioning results and checks of resources and applications.
File history alone does not establish where and when a change was applied or the current state.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- What is CloudFormation?Checked:
Scope and conditionsTemplates, stacks, declarations and provisioned resources have different roles. Documentation review; not live AWS validation.
Used in this lessonSeparate configuration, history, provisioning and resources Follow a change from authoring to verification History supports recovery; it does not restore all data
- Infrastructure as codeChecked:
Scope and conditionsDeclarative configuration, version history and review; distinguish recorded edits from applied changes. Documentation review; not live AWS validation.
Used in this lessonSeparate configuration, history, provisioning and resources Fixed example: changing 80 to 443 in Git Check your understanding of the workflow
- Update stacks using change setsChecked:
Scope and conditionsSeparate preview creation from execution; validation does not guarantee runtime success. Documentation review; not live AWS validation.
Used in this lessonFollow a change from authoring to verification The same file can have different inputs and targets Fixed example: changing 80 to 443 in Git Check your understanding of the workflow
- CloudFormation Parameters syntaxChecked:
Scope and conditionsInputs and AllowedValues scope; NoEcho exclusions including Outputs. Do not expose secrets. Documentation review; not live AWS validation.
Used in this lessonThe same file can have different inputs and targets Check your understanding of the workflow
Scope and conditionsDistinguish CloudFormation and underlying-service permissions; capability acknowledgement is not a permission grant. Documentation review; not live AWS validation.
Used in this lessonThe same file can have different inputs and targets Check your understanding of the workflow
- CloudFormation Outputs syntaxChecked:
Scope and conditionsOutputs differ from resources; outputs are not a secret-hiding store or proof of application success. Documentation review; not live AWS validation.
Used in this lessonThe same file can have different inputs and targets
Scope and conditionsSeparate operation/resource/stack statuses, zero-supported IN_SYNC, explicit/default properties, nesting, permissions and partial failure. Documentation review; not live AWS validation.
Used in this lessonThe same file can have different inputs and targets
- Using drift-aware change setsChecked:
Scope and conditionsThree-way comparison; unsupported types, write-only values, AWS-managed settings, external tags, immutable properties and cross-stack attachments limit reconciliation. Documentation review; not live AWS validation.
Used in this lessonThe same file can have different inputs and targets
Scope and conditionsType and property determine no-interruption updates, interruption or replacement and effects on physical identifiers. Documentation review; not live AWS validation.
Used in this lessonHistory supports recovery; it does not restore all data
- UpdateReplacePolicy attributeChecked:
Scope and conditionsApplies to the old physical resource at replacement; retention is not migration, recovery or availability, and Snapshot support varies. Documentation review; not live AWS validation.
Used in this lessonHistory supports recovery; it does not restore all data Check your understanding of the workflow