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

Support persistent spot requests #1011

Closed
wants to merge 1 commit into from

Conversation

benhamad
Copy link
Contributor

This means when the instance gets interrupted, the request is still
valid, and if the termination behaviour is set to "stop", the instance
will start automatically when the request get fulfilled again by AWS.

There's no way to achieve this with Boto2, so I changed the call that
create the spot request to Boto3. I did some refactoring, so the same
call is used when creating both On demand and spot instances.

an example:

{
    region ? "us-east-1"
    , accessKeyId ? "AKIA...."
, ...
}:
{
machine = {resources, ...}:
  { 
      deployment.targetEnv = "ec2";
      deployment.ec2.accessKeyId = accessKeyId;
      deployment.ec2.region = "us-east-1";
      deployment.ec2.instanceType = "m3.large";
      deployment.ec2.keyPair = resources.ec2KeyPairs.keypair;


      deployment.ec2.spotInstancePrice = 240;
      deployment.ec2.spotInstanceRequestType = "persistent";
      deployment.ec2.spotInstanceInterruptionBehavior = "stop";


      deployment.ec2.tags  = {
          Name = "persistant_spot_instance";
      };
      deployment.ec2.securityGroups = ["admin" "default"];
      fileSystems."/data" = {
        fsType = "xfs";
        device =  "/dev/xvdf";
        autoFormat = true;
        ec2.size = 5;
        ec2.volumeType = "gp2";
      };
    };
  resources.ec2KeyPairs.keypair = { inherit region accessKeyId; };
}

This means when the instance gets interrupted, the request is still
valid, and if the termination behaviour is set to "stop", the instance
will start automatically when the request get fulfilled again by AWS.

There's no way to achieve this with Boto2, so I changed the call that
create the spot request to Boto3. I did some refactoring, so the same
call is used when creating both On demand and spot instances.
@AmineChikhaoui
Copy link
Member

Closing as the work is picked up in #1102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants