【问题标题】:AWS Cloudformation:Template validation errorAWS Cloudformation:模板验证错误
【发布时间】:2017-11-04 06:20:44
【问题描述】:

我正在使用以下模板通过 cloudformation 创建作业定义。当我上传这个模板时,我收到了错误:

“模板验证错误:无效的模板属性或属性 [JobDefinition]”

我是否遗漏了模板中的某些内容?

{
  "JobDefinition": {
    "Type": "AWS::Batch::JobDefinition",
    "Properties": {
      "Type": "container",
      "JobDefinitionName" : "filedownload",
      "ContainerProperties": {
        "Image": "abc",
        "Vcpus": 4,
        "Memory": 2000,
        "JobRoleArn": "arn:aws:iam::********:role/batchjobRole",
        "ReadonlyRootFilesystem": true,
        "Privileged": true
    },   
    "RetryStrategy" : {"attempts": 1}    
    }
  }
}

【问题讨论】:

  • 那是你的“完整”模板吗?
  • 是的,我正在尝试使用此模板创建批处理作业定义
  • 我是否必须为作业定义指定所有参数,即使我没有使用它们?
  • 没有。请参阅此docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/…,了解哪些字段是必填字段。
  • @nadish 你的模板缩进正确吗?

标签: amazon-web-services templates amazon-cloudformation aws-batch


【解决方案1】:

您需要将"JobDefinition" 放入"Resources" 中。例如:

{
  "Resources": {
    "JobDefinition": {
      "Type": "AWS::Batch::JobDefinition",
      "Properties": {
        "Type": "container",
        "JobDefinitionName" : "filedownload",
        "ContainerProperties": {
          "Image": "abc",
          "Vcpus": 4,
          "Memory": 2000,
          "JobRoleArn": "arn:aws:iam::********:role/batchjobRole",
          "ReadonlyRootFilesystem": true,
          "Privileged": true
      },   
      "RetryStrategy" : {"attempts": 1}    
      }
    }
  }
}

【讨论】:

    猜你喜欢
    • 2016-12-03
    • 2018-06-03
    • 2016-07-11
    • 2018-06-03
    • 2018-06-22
    • 2016-09-30
    • 2015-11-09
    • 2015-02-14
    • 2021-05-24
    相关资源
    最近更新 更多