I've created spot requests in several different AWS regions. In most of the regions, there is a zone that is always lower-priced than the other zones so if I create a low-ball spot request in that region, all the instances that get created wind up in the low-price zone. No surprise there.

However, today I created spot requests in a new region. I created 20 requests, all with the same price. At the time, the spot price in both zones in the region were about the same, and my bid price was above that. Some my requests were fulfilled, and they all had instances in one zone. The price in that zone went up, of course, and it matched my bid price. Since my bid was now at the spot price, some of my requests went unfulfilled. This happened even though the price in the other zone remained at the same level, and was below my bid price.

Why did all my requests get filled in a single zone, even though there was capacity available in other zones (at a lower price)? When making the requests, I didn't specify a zone (nor a group).

Edit: FWIW, I'm not using the beta spot requests interface. I tried it a few times earlier this month, and it seemed a bit buggy to me so I'm still using original interface.

  • Did you ask AWS support? – Matt Houser Feb 9 '16 at 2:42
  • Thanks for the suggestion. No, I haven't asked them yet as I'm on the free tier for support. But maybe I'll bite the bullet and shell out the 50 bucks for the developer level support. – Armadillo Jim Feb 9 '16 at 3:57
  • Try asking in the free support forums. – Matt Houser Feb 9 '16 at 4:13
  • I would suggest that the first thing to verify is whether you can get a request fulfilled if you explicitly request the zone where your requests did not get fulfilled. If that succeeds, your question stands, but if it doesn't, then you actually have a different question to solve. – Michael - sqlbot Feb 9 '16 at 4:23
  • MattHouser, thanks. I'll try there. I guess my brain goes to SO by default. :) Michael-sqlbot, yeah, I've been able to successfully create spot requests in a single zone. That's not been a problem. It turns out I was mistakenly interpreting "no preference" for the zone to mean "any zone" whereas it actually means "pick a zone (and only one zone) for me". See my answer below. Thanks both for your comments! – Armadillo Jim Feb 10 '16 at 18:02

When you create your AWS account, Amazon automagically creates a default VPC in each region that spans the region. It also creates default subnets for you in each region; each subnet spans a single zone. (Note the plural "subnets".) There is no way for a subnet to span multiple zones.

When creating a spot request, you have the option of specifying a VPC and a subnet. If you want your spot request to only be for a specific zone, pick the default-generated subnet for that zone. (This addresses Michael's comment above.) That works just fine, and it's how I expected things to work.

However, you also have the option of "no preference" on the subnet (and the implied zone). I understood "no preference" to mean "any subnet". It looks like that's not the case (but I would welcome a correction here), and that "no preference" means Amazon picks a subnet for you from among the default subnets. That is, they pick a zone for you (as the zone is implied in the subnet they choose). It appears as though they pick the then-current low-price zone, but of course that won't always be the low-price zone for all time. And once the zone is chosen, it's fixed for the life of the request. (For a persistent request, that's forever.)

FWIW, another possibility is to create an auto-scaling group, and have it use spot instances instead of on-demand ones. With an auto-scaling group, you can have the group span multiple zones. However, it seems that the group always tries to spread requests across all the zones evenly regardless of price. It seems there is not an option for the group to place requests in the lowest price zone. But I s'pose that's a topic for another question ...

Update: I didn't use an auto-scaling group at first because it's more complicated than just creating a bunch of spot requests. But, of course, that didn't work either. It turns out the answer is: the only way to get the lowest-price zone is to use a spot fleet request.

I didn't do that at first either because it's more complicated to create, it requires the IAM user creating the fleet to have (slightly) more permissions than just ec2:* actions, and the interface is still a bit wonky. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html to get started. However, beware that this is still beta, and the documentation isn't up to date. Permissions also require "iam:GetRole", "iam:CreateRole", "iam:AttachRolePolicy". (The console will warn you about that when you try to create your first spot fleet. Apparently you still need these permissions even if the correct role already exists ... go figure.)

Back to my original problem: when creating the spot fleet, pick the "lowest price" strategy (which is not the default as the docs say, but it is available). Then -- as with auto-scaling group or spot request -- you must "select" the zones and check off them all (otherwise just the default zone is again used).

Hope someone finds this useful.

| improve this answer | |

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.