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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_spot_fleet_request: add support for launch-before-terminate rebalance strategy #22634

Open
partamonov opened this issue Jan 18, 2022 · 5 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.

Comments

@partamonov
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Now only supported type for capacity rebalance is launch, but that would be handy to support launch-before-terminate

New or Affected Resource(s)

  • aws_spot_fleet_request

Potential Terraform Configuration

resource "aws_spot_fleet_request" "fleet" {
  ...
  spot_maintenance_strategies {
      capacity_rebalance {
          replacement_strategy = "launch-before-terminate"
          timeout = 300
      }
   }
}

Link to AWS documentation

@partamonov partamonov added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 18, 2022
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jan 18, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jan 22, 2022
@sjonpaulbrown
Copy link

@partamonov have you tried using the "launch-before-terminate" value for the replacement_strategy. After looking at the available values for the replacement_strategy, it looks like "launch-before-terminate" before terminate is available is a value.

The documentation may need to need to be updated, but I believe this is already supported as the supported strategies are originating from the Golang SDK which has been updated with this value.

@partamonov
Copy link
Author

partamonov commented Jan 30, 2022

@sjonpaulbrown, yes I tried. It fails with missing mandatory timeout field, as with launch-before-terminate timeout is required field. My idea was exactly to try it, as I thought that default 120 seconds might work for me, but that field is not present in terraform input data, so request fails

type SpotCapacityRebalance struct {

    // The replacement strategy to use. Only available for fleets of type maintain.
    //
    // launch - Spot Fleet launches a new replacement Spot Instance when a rebalance
    // notification is emitted for an existing Spot Instance in the fleet. Spot
    // Fleet does not terminate the instances that receive a rebalance notification.
    // You can terminate the old instances, or you can leave them running. You are
    // charged for all instances while they are running.
    //
    // launch-before-terminate - Spot Fleet launches a new replacement Spot Instance
    // when a rebalance notification is emitted for an existing Spot Instance in
    // the fleet, and then, after a delay that you specify (in TerminationDelay),
    // terminates the instances that received a rebalance notification.
    ReplacementStrategy *string `locationName:"replacementStrategy" type:"string" enum:"ReplacementStrategy"`

    // The amount of time (in seconds) that Amazon EC2 waits before terminating
    // the old Spot Instance after launching a new replacement Spot Instance.
    //
    // Required when ReplacementStrategy is set to launch-before-terminate.
    //
    // Not valid when ReplacementStrategy is set to launch.
    //
    // Valid values: Minimum value of 120 seconds. Maximum value of 7200 seconds.
    TerminationDelay *int64 `locationName:"terminationDelay" type:"integer"`
    // contains filtered or unexported fields
}

@sjonpaulbrown
Copy link

Ah, that makes sense. So, the TerminationDelay field will need to be conditionally set when launch-before-terminate is defined as the replacement_strategy. This is helpful context to have and explains what needs to be updated to support this strategy.

@nglcasanova
Copy link

A spot fleet request with the "launch-before-terminate" replacement_strategy cannot be created using terraform-provider-aws version 4.14.0...

@kunalnanda
Copy link

This is a must have for us. I cannot use Terraform for Spot Fleet Requests as we need launch-before-terminate. I hate using Cloudformation, so would prefer if we can get some traction on this please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

5 participants