我正在关注此博客以运行terraform来启动eks集群。 https://github.com/berndonline/aws-eks-terraform/blob/master/
我只想将ec2 worker节点类型更改为Spot实例 https://github.com/berndonline/aws-eks-terraform/blob/master/eks-worker-nodes.tf 我用Google搜索并缩小了范围以启动配置部分,
任何想法如何将ec2类型更改为Spot实例?
答案 0 :(得分:0)
请仔细阅读有关资源aws_launch_configuration的正式文件
它为您提供了如何设置竞价型实例的示例:
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
}
}
现货实例的价格根据使用情况而不断变化。如果您不熟悉它,请使用其价格上的相同价格。
即使您设置为按价格购买,AWS也只会向您收取较少的费用(通常少5倍),除非用完了。但是AWS永远不会收取更多费用。
也请查看aws文档以获取详细信息:https://aws.amazon.com/ec2/spot/pricing/