Skip to content

aws.ec2.get_spot_placement_scores

Example SQL Queries

SELECT * FROM
aws.ec2.get_spot_placement_scores
WHERE
"target_capacity" = 'VALUE';

Description

Calculates the Spot placement score for a Region or Availability Zone based on the specified target capacity and compute requirements.

You can specify your compute requirements either by using InstanceRequirementsWithMetadata and letting Amazon EC2 choose the optimal instance types to fulfill your Spot request, or you can specify the instance types by using InstanceTypes.

For more information, see Spot placement score in the Amazon EC2 User Guide.

Table Definition

Column NameColumn Data Type
target_capacity Required Input Column

The target capacity.

BIGINT
dry_run Input Column

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

BOOLEAN
instance_requirements_with_metadata Input Column

The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance types with those attributes.

If you specify InstanceRequirementsWithMetadata, you can't specify InstanceTypes.

STRUCT(
"architecture_types" VARCHAR[],
"virtualization_types" VARCHAR[],
"instance_requirements" STRUCT(
"v_cpu_count" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"memory_mi_b" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"cpu_manufacturers" VARCHAR[],
"memory_gi_b_per_v_cpu" STRUCT(
"min" DOUBLE,
"max" DOUBLE
),
"excluded_instance_types" VARCHAR[],
"instance_generations" VARCHAR[],
"spot_max_price_percentage_over_lowest_price" BIGINT,
"on_demand_max_price_percentage_over_lowest_price" BIGINT,
"bare_metal" VARCHAR,
"burstable_performance" VARCHAR,
"require_hibernate_support" BOOLEAN,
"network_interface_count" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"local_storage" VARCHAR,
"local_storage_types" VARCHAR[],
"total_local_storage_gb" STRUCT(
"min" DOUBLE,
"max" DOUBLE
),
"baseline_ebs_bandwidth_mbps" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"accelerator_types" VARCHAR[],
"accelerator_count" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"accelerator_manufacturers" VARCHAR[],
"accelerator_names" VARCHAR[],
"accelerator_total_memory_mi_b" STRUCT(
"min" BIGINT,
"max" BIGINT
),
"network_bandwidth_gbps" STRUCT(
"min" DOUBLE,
"max" DOUBLE
),
"allowed_instance_types" VARCHAR[],
"max_spot_price_as_percentage_of_optimal_on_demand_price" BIGINT
)
)
Show child fields
instance_requirements_with_metadata.architecture_types[]
instance_requirements_with_metadata.instance_requirements

The attributes for the instance types. When you specify instance attributes, Amazon EC2 will identify instance types with those attributes.

Show child fields
instance_requirements_with_metadata.instance_requirements.accelerator_count

The minimum and maximum number of accelerators (GPUs, FPGAs, or Amazon Web Services Inferentia chips) on an instance.

To exclude accelerator-enabled instance types, set Max to 0.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.accelerator_count.max

The maximum number of accelerators. To specify no maximum limit, omit this parameter. To exclude accelerator-enabled instance types, set Max to 0.

instance_requirements_with_metadata.instance_requirements.accelerator_count.min

The minimum number of accelerators. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.accelerator_manufacturers[]
instance_requirements_with_metadata.instance_requirements.accelerator_names[]
instance_requirements_with_metadata.instance_requirements.accelerator_total_memory_mi_b

The minimum and maximum amount of total accelerator memory, in MiB.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.accelerator_total_memory_mi_b.max

The maximum amount of accelerator memory, in MiB. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.accelerator_total_memory_mi_b.min

The minimum amount of accelerator memory, in MiB. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.accelerator_types[]
instance_requirements_with_metadata.instance_requirements.allowed_instance_types[]
instance_requirements_with_metadata.instance_requirements.bare_metal

Indicates whether bare metal instance types must be included, excluded, or required.

  • To include bare metal instance types, specify included.

  • To require only bare metal instance types, specify required.

  • To exclude bare metal instance types, specify excluded.

Default: excluded

instance_requirements_with_metadata.instance_requirements.baseline_ebs_bandwidth_mbps

The minimum and maximum baseline bandwidth to Amazon EBS, in Mbps. For more information, see Amazon EBS–optimized instances in the Amazon EC2 User Guide.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.baseline_ebs_bandwidth_mbps.max

The maximum baseline bandwidth, in Mbps. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.baseline_ebs_bandwidth_mbps.min

The minimum baseline bandwidth, in Mbps. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.burstable_performance

Indicates whether burstable performance T instance types are included, excluded, or required. For more information, see Burstable performance instances.

  • To include burstable performance instance types, specify included.

  • To require only burstable performance instance types, specify required.

  • To exclude burstable performance instance types, specify excluded.

Default: excluded

instance_requirements_with_metadata.instance_requirements.cpu_manufacturers[]
instance_requirements_with_metadata.instance_requirements.excluded_instance_types[]
instance_requirements_with_metadata.instance_requirements.instance_generations[]
instance_requirements_with_metadata.instance_requirements.local_storage

Indicates whether instance types with instance store volumes are included, excluded, or required. For more information, Amazon EC2 instance store in the Amazon EC2 User Guide.

  • To include instance types with instance store volumes, specify included.

  • To require only instance types with instance store volumes, specify required.

  • To exclude instance types with instance store volumes, specify excluded.

Default: included

instance_requirements_with_metadata.instance_requirements.local_storage_types[]
instance_requirements_with_metadata.instance_requirements.max_spot_price_as_percentage_of_optimal_on_demand_price

[Price protection] The price protection threshold for Spot Instances, as a percentage of an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified price is from the lowest priced current generation instance types, and failing that, from the lowest priced previous generation instance types that match your attributes. When Amazon EC2 selects instance types with your attributes, it will exclude instance types whose price exceeds your specified threshold.

The parameter accepts an integer, which Amazon EC2 interprets as a percentage.

If you set TargetCapacityUnitType to vcpu or memory-mib, the price protection threshold is based on the per vCPU or per memory price instead of the per instance price.

Only one of SpotMaxPricePercentageOverLowestPrice or MaxSpotPriceAsPercentageOfOptimalOnDemandPrice can be specified. If you don't specify either, Amazon EC2 will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as 999999.

instance_requirements_with_metadata.instance_requirements.memory_gi_b_per_v_cpu

The minimum and maximum amount of memory per vCPU, in GiB.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.memory_gi_b_per_v_cpu.max

The maximum amount of memory per vCPU, in GiB. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.memory_gi_b_per_v_cpu.min

The minimum amount of memory per vCPU, in GiB. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.memory_mi_b

The minimum and maximum amount of memory, in MiB.

Show child fields
instance_requirements_with_metadata.instance_requirements.memory_mi_b.max

The maximum amount of memory, in MiB. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.memory_mi_b.min

The minimum amount of memory, in MiB. To specify no minimum limit, specify 0.

instance_requirements_with_metadata.instance_requirements.network_bandwidth_gbps

The minimum and maximum amount of baseline network bandwidth, in gigabits per second (Gbps). For more information, see Amazon EC2 instance network bandwidth in the Amazon EC2 User Guide.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.network_bandwidth_gbps.max

The maximum amount of network bandwidth, in Gbps. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.network_bandwidth_gbps.min

The minimum amount of network bandwidth, in Gbps. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.network_interface_count

The minimum and maximum number of network interfaces.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.network_interface_count.max

The maximum number of network interfaces. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.network_interface_count.min

The minimum number of network interfaces. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.on_demand_max_price_percentage_over_lowest_price

[Price protection] The price protection threshold for On-Demand Instances, as a percentage higher than an identified On-Demand price. The identified On-Demand price is the price of the lowest priced current generation C, M, or R instance type with your specified attributes. When Amazon EC2 selects instance types with your attributes, it will exclude instance types whose price exceeds your specified threshold.

The parameter accepts an integer, which Amazon EC2 interprets as a percentage.

To indicate no price protection threshold, specify a high value, such as 999999.

This parameter is not supported for GetSpotPlacementScores and GetInstanceTypesFromInstanceRequirements.

If you set TargetCapacityUnitType to vcpu or memory-mib, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per-instance price.

Default: 20

instance_requirements_with_metadata.instance_requirements.require_hibernate_support

Indicates whether instance types must support hibernation for On-Demand Instances.

This parameter is not supported for GetSpotPlacementScores.

Default: false

instance_requirements_with_metadata.instance_requirements.spot_max_price_percentage_over_lowest_price

[Price protection] The price protection threshold for Spot Instances, as a percentage higher than an identified Spot price. The identified Spot price is the Spot price of the lowest priced current generation C, M, or R instance type with your specified attributes. If no current generation C, M, or R instance type matches your attributes, then the identified Spot price is from the lowest priced current generation instance types, and failing that, from the lowest priced previous generation instance types that match your attributes. When Amazon EC2 selects instance types with your attributes, it will exclude instance types whose Spot price exceeds your specified threshold.

The parameter accepts an integer, which Amazon EC2 interprets as a percentage.

If you set TargetCapacityUnitType to vcpu or memory-mib, the price protection threshold is applied based on the per-vCPU or per-memory price instead of the per-instance price.

This parameter is not supported for GetSpotPlacementScores and GetInstanceTypesFromInstanceRequirements.

Only one of SpotMaxPricePercentageOverLowestPrice or MaxSpotPriceAsPercentageOfOptimalOnDemandPrice can be specified. If you don't specify either, Amazon EC2 will automatically apply optimal price protection to consistently select from a wide range of instance types. To indicate no price protection threshold for Spot Instances, meaning you want to consider all instance types that match your attributes, include one of these parameters and specify a high value, such as 999999.

Default: 100

instance_requirements_with_metadata.instance_requirements.total_local_storage_gb

The minimum and maximum amount of total local storage, in GB.

Default: No minimum or maximum limits

Show child fields
instance_requirements_with_metadata.instance_requirements.total_local_storage_gb.max

The maximum amount of total local storage, in GB. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.total_local_storage_gb.min

The minimum amount of total local storage, in GB. To specify no minimum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.v_cpu_count

The minimum and maximum number of vCPUs.

Show child fields
instance_requirements_with_metadata.instance_requirements.v_cpu_count.max

The maximum number of vCPUs. To specify no maximum limit, omit this parameter.

instance_requirements_with_metadata.instance_requirements.v_cpu_count.min

The minimum number of vCPUs. To specify no minimum limit, specify 0.

instance_requirements_with_metadata.virtualization_types[]
instance_types Input Column

The instance types. We recommend that you specify at least three instance types. If you specify one or two instance types, or specify variations of a single instance type (for example, an m3.xlarge with and without instance storage), the returned placement score will always be low.

If you specify InstanceTypes, you can't specify InstanceRequirementsWithMetadata.

VARCHAR[]
Show child fields
instance_types[]
region_names Input Column

The Regions used to narrow down the list of Regions to be scored. Enter the Region code, for example, us-east-1.

VARCHAR[]
Show child fields
region_names[]
single_availability_zone Input Column

Specify true so that the response returns a list of scored Availability Zones. Otherwise, the response returns a list of scored Regions.

A list of scored Availability Zones is useful if you want to launch all of your Spot capacity into a single Availability Zone.

BOOLEAN
target_capacity_unit_type Input Column

The unit for the target capacity.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
availability_zone_id

The Availability Zone.

VARCHAR
region

The Region.

VARCHAR
score

The placement score, on a scale from 1 to 10. A score of 10 indicates that your Spot request is highly likely to succeed in this Region or Availability Zone. A score of 1 indicates that your Spot request is not likely to succeed.

BIGINT