I'm trying to setup vagrant to deploy locally, while we also want to deploy to elasticbeanstalk. So how can I make my local cent OS Vagrant VM as close to the Amazon EMI as possible?

My co-worker suggested possibly installing everything under /etc/yum/yum.repos.d on the Amazon machine, on to the Vagrant Cent OS machine.

Any suggestions? Thanks

  • Using the .repo files from the ec2 instance failed due to permissions. You have to be in the amazon network to yum update those. – usersome101 Oct 11 '13 at 11:36

As a one-off, I'd suggest using the AWS VMimport feature, which also allows you to export (some) EC2 virtual machines. More information on that can be found here:


If this turns out not to be feasible for you and if your EC2 instance is EBS-based, you can also try the following:

Stop your EC2 instance, and detach the root volume. Attach the root volume to another running Linux instance at /dev/sdf. In the new instance use the dd command to take a dump of the root partition and output it somewhere you have space (i.e. 'dd if=/dev/sda1 of=/mnt/another_volume/sda1.img bs=1M'). Copy - using scp, ftp or the method of your choice - the new sda1.img to your local machine. You should be able to use this image with Vagrant to spin up a local VM. In the meantime, put your root volume back on your original instance and start the instance again (don't forget to re-attach your elastic IP address if you're using one - they detach on a stop).

Another alternative might be to use 'system-config-kickstart' to generate a kickstart file on your EC2 instance, and use this to build your new local VM. I haven't done this myself though, so you may also want to dump installed packages on your EC2 instance ('rpm -qa --queryformat "%{NAME}\n"') and compare with the resulting kickstart configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.