-1

I'm using vagrant-aws Vagrant plugin to run multiple disposable EC2 instances which are running tests, however my problem is that the provisioning script takes too long time (e.g. apt-get and downloading same files). I'm terminating my instances after run, as I don't want to pay for the existing instances when they're not in use (100x16G).

How can I configure my Vagrantfile, or in other words, what's the easiest way doing that, so I can re-use the same volume across multiple EC2 instances? Like mounting the specific volume, snapshot, creating ami or anything else? For example having 20 pre-configured volumes, each used by 200 disposable instances on startup time.

kenorb
  • 155,785
  • 88
  • 678
  • 743

1 Answers1

1

If I get your question right, you want to save your instance the way it is before you terminate them.

First let me ask, isn't it easier if you just pause your instance? No hourly charges applied on a stopped instance, you only pay for the volumes reserved (full size of your volumes).

Another approach would be to create an image (AMI - Amazon Machine Image) of your instance the way it is when it's ready to work. To do that:

EC2 > Instances > Select your instance > Actions > Image > Create Image

After your image is ready, it will show up in:

EC2 > AMIs

Where you can select an image and then:

Actions > Launch

You can repeat this launch process as many times as you want, each time a new copy of the same original instance will be created.

Note: AWS will charge for the disk space used by your images, so keep an eye on that before creating lots of images - at least if your instances use big volumes.

Hope this helps,