Search code examples
amazon-web-servicesmesosphere

Spot Instances Support DCOS


Is it possible to change the DCOS template to use spot instances? I have looked around and there does not seem to be much information regarding this.


Solution

  • Okay, given the DCOS template, the LaunchConfiguration for the slaves looks like this: (I've shortened it somewhat)

    "MasterLaunchConfig": {
      "Type": "AWS::AutoScaling::LaunchConfiguration",
      "Properties": {
        "IamInstanceProfile": { "Ref": "MasterInstanceProfile" },
        "SecurityGroups": [ ... ],
        "ImageId": { ... },
        "InstanceType": { ... },
        "KeyName": { "Ref": "KeyName" },
        "UserData": { ... }
      }
    }
    

    To get started, all you need to do is add the SpotPrice property in there. The value of SpotPrice is, obviously, the maximum price you want to pay. You'll probably need to do more work around autoscaling, especially with alarms and time of day. So here's your new LaunchConfiguration with a spot price of $1.00 per hour:

    "MasterLaunchConfig": {
      "Type": "AWS::AutoScaling::LaunchConfiguration",
      "Properties": {
        "IamInstanceProfile": { "Ref": "MasterInstanceProfile" },
        "SecurityGroups": [ ... ],
        "ImageId": { ... },
        "InstanceType": { ... },
        "KeyName": { "Ref": "KeyName" },
        "UserData": { ... },
        "SpotPrice": 1.00
      }
    }