简体   繁体   中英

AWS Cloudformation:Template validation error

I am using the below template to create a job definition using the cloudformation. When I upload this template, I am getting the error:

"Template validation error: Invalid template property or properties [JobDefinition]"

did I miss something in my template?

{
  "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}    
    }
  }
}

You need to put "JobDefinition" inside "Resources" . For example:

{
  "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}    
      }
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM