diff --git a/Vagrantfile b/Vagrantfile index ee08487be66..a053be28d01 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -51,6 +51,9 @@ ec2_subnet_id = nil # Only override this by setting it to false if you're running in a VPC and you # are running Vagrant from within that VPC as well. ec2_associate_public_ip = nil +ec2_iam_instance_profile_name = nil + +ebs_volume_type = 'gp3' jdk_major = '8' jdk_full = '8u202-linux-x64' @@ -60,6 +63,18 @@ if File.exists?(local_config_file) then eval(File.read(local_config_file), binding, "Vagrantfile.local") end +# override any instance type set by Vagrantfile.local or above via an environment variable +if ENV['INSTANCE_TYPE'] then + ec2_instance_type = ENV['INSTANCE_TYPE'] +end + +# choose size based on overridden size +if ec2_instance_type.start_with?("m3") then + ebs_volume_size = 20 +else + ebs_volume_size = 40 +end + # TODO(ksweeney): RAM requirements are not empirical and can probably be significantly lowered. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.hostmanager.enabled = enable_hostmanager @@ -118,9 +133,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| aws.region = ec2_region aws.availability_zone = ec2_az aws.instance_type = ec2_instance_type + aws.ami = ec2_ami aws.security_groups = ec2_security_groups aws.subnet_id = ec2_subnet_id + aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeType' => ebs_volume_type, 'Ebs.VolumeSize' => ebs_volume_size }] # If a subnet is specified, default to turning on a public IP unless the # user explicitly specifies the option. Without a public IP, Vagrant won't # be able to SSH into the hosts unless Vagrant is also running in the VPC. @@ -133,6 +150,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| region.spot_instance = ec2_spot_instance region.spot_max_price = ec2_spot_max_price end + aws.iam_instance_profile_name = ec2_iam_instance_profile_name # 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/']