Immutable Infrastructure
Explain immutable infrastructure and its benefits. How does it differ from traditional server management?
Immutable infrastructure means never modifying running instances post-deployment. Instead of patching servers, you build new machine images with updates, deploy fresh instances, and destroy old ones. Benefits include: no configuration drift, consistent environments, easy rollbacks (previous image), simpler debugging (fewer variables), and better security (no SSH access needed).
The key principle is 'pets vs cattle' - treating infrastructure as disposable rather than precious. Traditional approaches SSH into servers and run updates, leading to drift over time where servers become unique snowflakes. Immutable infrastructure ensures every deployment is identical and reproducible.
Packer AMI build
Blue-green with new AMI
- SSH-ing into production servers to make 'quick fixes'
- Not versioning machine images properly
- Building images too slowly, making deployments take too long
- How do you handle stateful applications with immutable infrastructure?
- What tools do you use to build machine images?
- How do you manage secrets in an immutable infrastructure setup?