From c68ddef4e917418b8c709ba3f3eab652ef79eb5a Mon Sep 17 00:00:00 2001 From: "Ryan S. Brown" Date: Wed, 29 Jun 2016 07:00:21 -0400 Subject: [PATCH] (AWS Spot) Add 0.5 cents to discovered spot price Related to #2979 , in volatile spot markets the automatic price can cause your instances to be evicted if the spot price rises. This change adds one half a cent to your bid to protect against small amounts of price volatility. --- builder/amazon/common/step_run_source_instance.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index aac13fb88..f5ffe834c 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -129,6 +129,10 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt + } else { + // Add 0.5 cents to minimum spot bid to ensure capacity will be available + // Avoids price-too-low error in active markets which can fluctuate + price = price + 0.005 } spotPrice = strconv.FormatFloat(price, 'f', -1, 64)