Check stock before you launch
See which instance types each zone can sell right now, so a launch goes where the type is in stock.
Machines come from live stock in each zone, and a type can be sold out in de1a while de1b still
has it. The platform reads the stock every minute.
Prerequisites
- Permission for
ec2:DescribeInstanceTypeOfferings(CLI, API, Terraform). The console shows stock in the Create instance form, which needsec2:RunInstances.
See the stock
- Open Compute, then choose Create instance.
- Under Size, open Instance type. A type sold out in every zone is greyed and marked sold out.
- Choose a type. Under Basics, the Availability zone list marks each zone where that type is sold out with type sold out.
- When the chosen type is sold out in the chosen zone, a note appears under the type picker. It names the zones that have the type, with a Use zone button for each, and under In stock where it goes a button for each in-stock type with its monthly price.
dcloud ec2 instance-type-offerings list --instance-type performance-2GET /ec2/api/instance-type-offerings?instanceType=performance-2{
"success": true,
"data": [
{ "instanceType": "performance-2", "availabilityZoneId": "de1a", "providerLocation": "fsn1", "inStock": false, "changedAt": "…", "checkedAt": "…" },
{ "instanceType": "performance-2", "availabilityZoneId": "de1b", "providerLocation": "nbg1", "inStock": true, "changedAt": "…", "checkedAt": "…" }
],
"unknownZones": []
}Filters: regionId (default: yours), availabilityZoneId, instanceType.
Use the dcloud_instance_type_offerings data source.
Result
One row per type and zone, sorted by type, then zone. A zone in unknownZones could not be read
just now, which is not the same as sold out.
When a launch hits a stock-out
A launch of a type sold out in its zone is refused with 409 before anything is bought; the
message also names the other zones that have the type, when there are any. A resize to a sold-out
type is refused with 409 as well. When the provider refuses a create that the last check still
saw in stock, the launch is refused with 409 and the type is recorded as sold out at once, so
every picker shows it. Every launch refused for stock is also reported as an event and a metric;
see Monitoring.