Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation: price-capacity-optimized spot allocation strategy #27795

Merged
merged 5 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changelog/27795.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:enhancement
resource/aws_autoscaling_group: Add support for `price-capacity-optimized` `spot_allocation_strategy` value
```

```release-note:note
resource/aws_ec2_fleet: Add support for `price-capacity-optimized` `spot_options.allocation_strategy` value
```

```release-note:note
resource/aws_spot_fleet_request: Add support for `priceCapacityOptimized` `allocation_strategy` value
```
15 changes: 3 additions & 12 deletions internal/service/ec2/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ec2

import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform-provider-aws/internal/slices"
)

const (
Expand All @@ -24,7 +25,7 @@ const (

func FleetOnDemandAllocationStrategy_Values() []string {
return append(
removeFirstOccurrenceFromStringSlice(ec2.FleetOnDemandAllocationStrategy_Values(), ec2.FleetOnDemandAllocationStrategyLowestPrice),
slices.RemoveAll(ec2.FleetOnDemandAllocationStrategy_Values(), ec2.FleetOnDemandAllocationStrategyLowestPrice),
FleetOnDemandAllocationStrategyLowestPrice,
)
}
Expand All @@ -36,7 +37,7 @@ const (

func SpotAllocationStrategy_Values() []string {
return append(
removeFirstOccurrenceFromStringSlice(ec2.SpotAllocationStrategy_Values(), ec2.SpotAllocationStrategyLowestPrice),
slices.RemoveAll(ec2.SpotAllocationStrategy_Values(), ec2.SpotAllocationStrategyLowestPrice),
SpotAllocationStrategyLowestPrice,
)
}
Expand Down Expand Up @@ -252,16 +253,6 @@ const (
TargetStorageTierStandard = "standard"
)

func removeFirstOccurrenceFromStringSlice(slice []string, s string) []string {
for i, v := range slice {
if v == s {
return append(slice[:i], slice[i+1:]...)
}
}

return slice
}

const (
OutsideIPAddressTypePrivateIPv4 = "PrivateIpv4"
OutsideIPAddressTypePublicIPv4 = "PublicIpv4"
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/autoscaling_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ This configuration block supports the following:
* `on_demand_allocation_strategy` - (Optional) Strategy to use when launching on-demand instances. Valid values: `prioritized`. Default: `prioritized`.
* `on_demand_base_capacity` - (Optional) Absolute minimum amount of desired capacity that must be fulfilled by on-demand instances. Default: `0`.
* `on_demand_percentage_above_base_capacity` - (Optional) Percentage split between on-demand and Spot instances above the base on-demand capacity. Default: `100`.
* `spot_allocation_strategy` - (Optional) How to allocate capacity across the Spot pools. Valid values: `lowest-price`, `capacity-optimized`, `capacity-optimized-prioritized`. Default: `lowest-price`.
* `spot_allocation_strategy` - (Optional) How to allocate capacity across the Spot pools. Valid values: `lowest-price`, `capacity-optimized`, `capacity-optimized-prioritized`, and `price-capacity-optimized`. Default: `lowest-price`.
* `spot_instance_pools` - (Optional) Number of Spot pools per availability zone to allocate capacity. EC2 Auto Scaling selects the cheapest Spot pools and evenly allocates Spot capacity across the number of Spot pools that you specify. Only available with `spot_allocation_strategy` set to `lowest-price`. Otherwise it must be set to `0`, if it has been defined before. Default: `2`.
* `spot_max_price` - (Optional) Maximum price per unit hour that the user is willing to pay for the Spot instances. Default: an empty string which means the on-demand price.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/ec2_fleet.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ This configuration block supports the following:

### spot_options

* `allocation_strategy` - (Optional) How to allocate the target capacity across the Spot pools. Valid values: `diversified`, `lowestPrice`, `capacity-optimized` and `capacity-optimized-prioritized`. Default: `lowestPrice`.
* `allocation_strategy` - (Optional) How to allocate the target capacity across the Spot pools. Valid values: `diversified`, `lowestPrice`, `capacity-optimized`, `capacity-optimized-prioritized` and `price-capacity-optimized`. Default: `lowestPrice`.
* `instance_interruption_behavior` - (Optional) Behavior when a Spot Instance is interrupted. Valid values: `hibernate`, `stop`, `terminate`. Default: `terminate`.
* `instance_pools_to_use_count` - (Optional) Number of Spot pools across which to allocate your target Spot capacity. Valid only when Spot `allocation_strategy` is set to `lowestPrice`. Default: `1`.
* `maintenance_strategies` - (Optional) Nested argument containing maintenance strategies for managing your Spot Instances that are at an elevated risk of being interrupted. Defined below.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/spot_fleet_request.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ across different markets and instance types. Conflicts with `launch_template_con
important to your application workload, such as vCPUs, memory, or I/O.
* `target_capacity_unit_type` - (Optional) The unit for the target capacity. This can only be done with `instance_requirements` defined
* `allocation_strategy` - Indicates how to allocate the target capacity across
the Spot pools specified by the Spot fleet request. The default is
the Spot pools specified by the Spot fleet request. Valid values: `lowestPrice`, `diversified`, `capacityOptimized`, `capacityOptimizedPrioritized`, and `priceCapacityOptimized`. The default is
`lowestPrice`.
* `instance_pools_to_use_count` - (Optional; Default: 1)
The number of Spot pools across which to allocate your target Spot capacity.
Expand Down