简体   繁体   English

Terraform aws eks worker节点现货实例

[英]Terraform aws eks worker node spot instance

I am following this blog to run terraform to spin up an eks cluster.我正在关注此博客以运行 terraform 来启动 eks 集群。 https://github.com/berndonline/aws-eks-terraform/blob/master/ https://github.com/berndonline/aws-eks-terraform/blob/master/

I just want to change my ec2 worker node type to spot instance https://github.com/berndonline/aws-eks-terraform/blob/master/eks-worker-nodes.tf I googled and narrowed it down to launch configuration section,我只想将我的 ec2 工作节点类型更改为 spot 实例https://github.com/berndonline/aws-eks-terraform/blob/master/eks-worker-nodes.tf我用谷歌搜索并将其缩小到启动配置部分,

any ideas how to change the ec2 type to spot instance?任何想法如何更改 ec2 类型以发现实例?

Please go through the official document about resource aws_launch_configuration请go通过关于资源aws_launch_configuration的官方文档

it gives you the sample on how to set spot instance already:它已经为您提供了有关如何设置 spot 实例的示例:


resource "aws_launch_configuration" "as_conf" {
  image_id      = "${data.aws_ami.ubuntu.id}"
  instance_type = "m4.large"
  spot_price    = "0.001"

  lifecycle {
    create_before_destroy = true
  }
}

Notes:笔记:

spot instances price are keep changing depend on the usage.现货实例价格根据使用情况不断变化。 If you are not familiar with it, use the same price of its on-demond price.如果您不熟悉它,请使用与其上架价格相同的价格。

Even you set as on-demond price, AWS will only charge you less (normally 5 times less), unless they are used out.即使您设置为按需价格,AWS 也只会向您收取更少的费用(通常少 5 倍),除非它们用完了。 But AWS will never charge more.但 AWS 永远不会收取更多费用。

Please also go through aws document for details: https://aws.amazon.com/ec2/spot/pricing/也请go通过aws文档了解详情: https://aws.amazon.com/ec2/spot/pricing/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM