Immutable infrastructure creates a new resource for every configuration change instead of modifying an existing resource. Replacing resources can reduce failure risk and configuration drift by aligning deployed state with infrastructure as code. section 2.2
Apply the approach through replacement and reconciliation:
- Create a new server with Python 3 and compatible dependencies, then delete the old Python 2 server. section 2.2
- Generate a new machine image for server updates, passing resource-specific values such as IP registration through startup parameters. section 2.2
- If an urgent out-of-band change modifies a resource directly, update version control and infrastructure as code to reconcile actual and desired state. section 2.2.1
Figure 2.2 You treat the server mutably by logging in and updating the Python package version. By comparison, you treat the server immutably by replacing the old server with a new one upgraded to Python 3.
Compare in-place Python updates with replacing the server using an upgraded resource. section 2.2
