Immutable & mutable infrastructure
Example:
You add a database to your infrastructure: VM, VPC + database. Scale it 1000 times.
Mutable approach - environment (configuration) drift (move the infrastructure from V1 to V2 with a mutation custom script):
- 99% it is working, but 1% failing in a limbo state.
- Existing environment no longer matches what we have in our automation.
- To debug you would have to:
- wipe out the entire environment
- redeploy V1
- run those scripts
- When moving to scale it becomes incredibly hard to maintain.
Immutable approach - a new environment alongside the old one:
- When they are both working you bring down the older version.
- It is expensive (V1 and V2 are running at the same time).
- But it's a best practice to ensure that your infrastructure can scale.