【问题标题】:EMR creation task and core nodes not able to specify as "Max on demand" for spot pricingEMR 创建任务和核心节点无法指定为现货定价的“按需最大值”
【发布时间】:2019-12-01 16:39:27
【问题描述】:
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 中传递此参数。

【问题讨论】:

    标签: amazon-web-services terraform amazon-emr terraform-provider-aws


    【解决方案1】:

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

    类似这样的:

    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]
      }
    }
    

    【讨论】:

      【解决方案2】:

      我从 GitHub 发现了一个持续存在的问题。

      https://github.com/terraform-providers/terraform-provider-aws/issues/7155

      尚未应用,您想要的功能似乎还不存在。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-07-30
        • 1970-01-01
        • 2022-11-07
        相关资源
        最近更新 更多