Interview Prep/Linux/Scheduling, automation and scripting

Your team keeps writing the same server bootstrap steps by hand. How would you automate first-boot configuration for new cloud VMs?

AdvancedScenarioScheduling, automation and scripting
Answer

Situation read → Use cloud-init plus config management, and bake images.

What I'd do →

#cloud-config
users:
  - name: ops
    groups: wheel
    ssh_authorized_keys: [ "ssh-ed25519 AAAA... ops" ]
package_update: true
packages: [chrony, auditd, amazon-cloudwatch-agent]
runcmd:
  - [ systemctl, enable, --now, chronyd ]
  - [ sh, -c, "curl -fsSL https://config.internal/bootstrap.sh | bash" ]

Bake the slow parts into a golden image with Packer; let cloud-init do only host-specific bits.

Why → Faster boot, consistent results, fewer moving parts at scale.

Interview tip → Check cloud-init status --long and /var/log/cloud-init-output.log when it goes wrong.

All Linux questions Roadmap: Linux

More on Scheduling, automation and scripting