Answers: <p>It can be done by modifying the <a href="https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2018-08-30/amazon-eks-nodegroup.yaml" rel="nofollow noreferrer">Cloudformation Template</a> (which is mentioned in this <a href="https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html" rel="nofollow noreferrer">document</a>) in the <code>LaunchConfiguration</code> section to specify a spot price.</p>
  
  <pre><code>NodeLaunchConfig:
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties:
      SpotPrice: "20" # &lt;=== Here
      AssociatePublicIpAddress: 'true'
      IamInstanceProfile: !Ref NodeInstanceProfile
      ImageId: !Ref NodeImageId
      InstanceType: !Ref NodeInstanceType
      KeyName: !Ref KeyName
      SecurityGroups:
      - !Ref NodeSecurityGroup
      BlockDeviceMappings:
        - DeviceName: /dev/xvda
          Ebs:
            VolumeSize: !Ref NodeVolumeSize
            VolumeType: gp2
            DeleteOnTermination: true
      UserData:
        Fn::Base64:
          !Sub |
            #!/bin/bash
            set -o xtrace
            /etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments}
            /opt/aws/bin/cfn-signal --exit-code $? \
                     --stack  ${AWS::StackName} \
                     --resource NodeGroup  \
                     --region ${AWS::Region}
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-27T13:55:25.030Z
Answers: 2018-10-27T13:55:25.030Z
Answers: Lior Bar-On
Body: <p>When using AWS EKS, is it possible to set up the worker nodes on spot instances?
  how?
  Anything I special I should pay attention to, in such a setup?</p>
  
Tags: <amazon-web-services><kubernetes>
Title: Amazon EKS: using spot instances for worker nodes
UserDisplayName: Lior Bar-On
ThreadText: # Amazon EKS: using spot instances for worker nodes
  
  (Asked by: username_0 on 2018-10-19)
  
  When using AWS EKS, is it possible to set up the worker nodes on spot instances?
  how?
  Anything I special I should pay attention to, in such a setup?
  
  **Tags:** amazon-web-services, kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-10-27. Score: 0 | Accepted answer
  
  It can be done by modifying the [Cloudformation Template](https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2018-08-30/amazon-eks-nodegroup.yaml) (which is mentioned in this [document](https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html)) in the `LaunchConfiguration` section to specify a spot price.
  
  ```
  NodeLaunchConfig:
    Type: AWS::AutoScaling::LaunchConfiguration
    Properties:
      SpotPrice: "20" # <=== Here
      AssociatePublicIpAddress: 'true'
      IamInstanceProfile: !Ref NodeInstanceProfile
      ImageId: !Ref NodeImageId
      InstanceType: !Ref NodeInstanceType
      KeyName: !Ref KeyName
      SecurityGroups:
      - !Ref NodeSecurityGroup
      BlockDeviceMappings:
        - DeviceName: /dev/xvda
          Ebs:
            VolumeSize: !Ref NodeVolumeSize
            VolumeType: gp2
            DeleteOnTermination: true
      UserData:
        Fn::Base64:
          !Sub |
            #!/bin/bash
            set -o xtrace
            /etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments}
            /opt/aws/bin/cfn-signal --exit-code $? \
                     --stack  ${AWS::StackName} \
                     --resource NodeGroup  \
                     --region ${AWS::Region}
  
  ```
  
  
  ---
  
  