diff --git a/Vagrantfile b/Vagrantfile index 363607691fd..88f2028f01e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -42,6 +42,8 @@ ec2_region = "us-east-1" ec2_az = nil # Uses set by AWS ec2_ami = "ami-905730e8" ec2_instance_type = "m3.medium" +ec2_spot_instance = ENV['SPOT_INSTANCE'] ? ENV['SPOT_INSTANCE'] == 'true' : true +ec2_spot_max_price = "0.113" # On-demand price for instance type ec2_user = "ubuntu" ec2_instance_name_prefix = "kafka-vagrant" ec2_security_groups = nil @@ -133,6 +135,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| else aws.associate_public_ip = ec2_associate_public_ip end + aws.region_config ec2_region do |region| + region.spot_instance = ec2_spot_instance + region.spot_max_price = ec2_spot_max_price + end # Exclude some directories that can grow very large from syncing override.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ['.git', 'core/data/', 'logs/', 'tests/results/', 'results/'] diff --git a/tests/README.md b/tests/README.md index f0ffdf521f3..f42b28ac22d 100644 --- a/tests/README.md +++ b/tests/README.md @@ -461,6 +461,7 @@ the test driver machine. ec2_instance_type = "..." # Pick something appropriate for your # test. Note that the default m3.medium has # a small disk. + ec2_spot_max_price = "0.123" # On-demand price for instance type enable_hostmanager = false num_zookeepers = 0 num_kafka = 0 diff --git a/vagrant/aws/aws-example-Vagrantfile.local b/vagrant/aws/aws-example-Vagrantfile.local index ee9db9a616b..23187a085d3 100644 --- a/vagrant/aws/aws-example-Vagrantfile.local +++ b/vagrant/aws/aws-example-Vagrantfile.local @@ -17,6 +17,7 @@ # To use it, move it to the base kafka directory and rename # it to Vagrantfile.local, and adjust variables as needed. ec2_instance_type = "m3.xlarge" +ec2_spot_max_price = "0.266" # On-demand price for instance type enable_hostmanager = false num_zookeepers = 0 num_brokers = 0 diff --git a/vagrant/aws/aws-init.sh b/vagrant/aws/aws-init.sh index 75176263438..54092c82a29 100755 --- a/vagrant/aws/aws-init.sh +++ b/vagrant/aws/aws-init.sh @@ -31,15 +31,18 @@ base_dir=`dirname $0`/../.. if [ -z `which vagrant` ]; then echo "Installing vagrant..." - wget https://releases.hashicorp.com/vagrant/1.9.3/vagrant_1.9.3_x86_64.deb - sudo dpkg -i vagrant_1.9.3_x86_64.deb - rm -f vagrant_1.9.3_x86_64.deb + wget https://releases.hashicorp.com/vagrant/2.1.5/vagrant_2.1.5_x86_64.deb + sudo dpkg -i vagrant_2.1.5_x86_64.deb + rm -f vagrant_2.1.5_x86_64.deb fi # Install necessary vagrant plugins # Note: Do NOT install vagrant-cachier since it doesn't work on AWS and only # adds log noise -vagrant_plugins="vagrant-aws vagrant-hostmanager" + +# Custom vagrant-aws with spot instance support. See https://github.com/mitchellh/vagrant-aws/issues/32 +wget -nv https://s3-us-west-2.amazonaws.com/confluent-packaging-tools/vagrant-aws-0.7.2.spot.gem -P /tmp +vagrant_plugins="/tmp/vagrant-aws-0.7.2.spot.gem vagrant-hostmanager" existing=`vagrant plugin list` for plugin in $vagrant_plugins; do echo $existing | grep $plugin > /dev/null