I’m building a piece of software that needs to spin up KVM guests dynamically from a script. I’m hoping that KVM offers an ‘AMI’ like functionality so that I can spin up new guests without having to go through the entire OS install process.
I’ve read a little about the ‘migrate’ functionality but its doesn’t sound quite right.
I would really like to be able to build up a guest, image it, and then be able to spin up clones of that image over and over.
Just in case the answer to this can be helpful to anyone else who is trying to create analogies between EC2 and KVM here you go.
With KVM, when you start up a guest you specify a disk image file (guestos.img). To reuse that same “image” with another guest all you have to do is shutdown the original guest, copy it’s image (and probably rename for clarity’s sake) and then start a new guest that points to the copied image. Voila!
Here’s some code for giggles: