EMR 创建任务和核心节点无法指定为“Max on demand";现货定价 [英] EMR creation task and core nodes not able to specify as "Max on demand" for spot pricing

查看:15
本文介绍了EMR 创建任务和核心节点无法指定为“Max on demand";现货定价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

core_instance_group {
    instance_type  = "c4.large"
    instance_count = 1

    ebs_config {
      size                 = "40"
      type                 = "gp2"
      volumes_per_instance = 1
    }

    bid_price = "0.30"

我需要bid_price = "max on-demand".不确定如何在 terraform 中传递此参数.

I would require the bid_price = "max on-demand". Not sure how to pass this parameter in terraform.

推荐答案

我想出了一个办法.但是,包含几个用于获取价格详细信息的脚本.

I figured out a way. However, included couple of scripts to fetch the price details.

类似这样的:

AWS 价格命令:

 InstanceType=$1
aws pricing get-products --filters Type=TERM_MATCH,Field=instanceType,Value=${InstanceType} Type=TERM_MATCH,Field=capacityStatus,Value=Used Type=TERM_MATCH,Field=operatingSystem,Value=Linux Type=TERM_MATCH,Field=location,Value="US East (N. Virginia)" Type=TERM_MATCH,Field=preInstalledSw,Value=NA Type=TERM_MATCH,Field=tenancy,Value=Shared --format-version aws_v1 --region us-east-1 --service-code AmazonEC2 | jq '.PriceList[]' | sed 's/\//g' | sed -e 's/^.//' -e 's/.$//' | jq '.terms.OnDemand' | jq '(.. | .pricePerUnit?)' | grep "USD" | awk '{print $2}' | sed -r 's/.{8}$//'| sed 's/$/"/'

地形代码:

resource "null_resource" "price_details" {
  provisioner "local-exec" {
    command = "/root/gv/price.sh ${var.core-type} 2>stderr >stdout; echo $? >exitstatus"
  }
}

data "external" "stdout" {
  depends_on = [null_resource.price_details]
  program    = ["sh", "/opt/terraform-test/read.sh", "/opt/terraform-test/stdout"]
}

resource "null_resource" "contents" {
  depends_on = [null_resource.price_details]

  triggers = {
    stdout     = data.external.stdout.result["content"]
  }
  lifecycle {
    ignore_changes = [triggers]
  }
}

这篇关于EMR 创建任务和核心节点无法指定为“Max on demand";现货定价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆