AWS Cloudformation:Template 验证错误

AWS Cloudformation:Template validation error

我正在使用以下模板使用 cloudformation 创建作业定义。当我上传此模板时,出现错误:

"Template validation error: Invalid template property or properties [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}    
    }
  }
}

你需要把"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}    
      }
    }
  }
}