Migrate a legacy app with config files baked into the VM image to an immutable deployment model. Where do you start?
IntermediateScenarioMigrations
Answer
Situation read → Immutable means the artifact never changes after build; config comes from outside at runtime.
What I'd do →
- Find all config on the box: diff a running server against a clean image, and check
/etc, app directories and environment files. Ansible facts orrpm -Va/debsumshelp spot changed files. - Split into code (goes in the image), config (environment-specific, goes to SSM, Secrets Manager or ConfigMaps) and data (goes to managed storage).
- Build the image in CI with Packer or Docker; no SSH-and-edit after.
- Deploy by replacing instances (ASG instance refresh) rather than patching them.
aws autoscaling start-instance-refresh --auto-scaling-group-name legacy-app --preferences MinHealthyPercentage=90
- Remove SSH access once you trust it; use SSM Session Manager for break-glass.
Why → If a server can be edited by hand, it eventually will be, and drift follows.
Interview tip → "Replace, don't patch" summarises immutable infrastructure.
More on Migrations
Migrate an application from EC2 to EKS with zero downtime. Walk me through it.AdvancedMigrate a database from on-prem MySQL to Amazon RDS with minimal downtime. How?AdvancedYou need to move Terraform state from local files to an S3 backend. How?BeginnerMigrate CI from Jenkins to GitHub Actions for 80 repositories. How do you plan it?IntermediateUpgrade an EKS cluster from 1.30 to 1.31 in production. What's your process?IntermediateMove from a monolith to microservices. What's the DevOps side of the migration?Advanced