Cloudformation AWS::Batch::JobDefinition 属性 验证失败:[在 {/} 中遇到不受支持的属性:[LogConfiguration]]

Cloudformation AWS::Batch::JobDefinition Property validation failure: [Encountered unsupported properties in {/}: [LogConfiguration]]

AWS::Batch::JobDefinition 的 AWS CloudFormation 用户指南说有 LogConfiguration 属性。但是,当我尝试下面的代码时出现错误。

我的 CloudFormation 代码:

# AWS Batch Job Definition
  BatchProcessingJobDefinition:
    Type: AWS::Batch::JobDefinition
    Properties:
      Type: container
      JobDefinitionName: 
        Fn::Join:
        - ''
        - - !Ref 'AWS::StackName'
          - '-BatchJobDefinition'
      ContainerProperties:
        Image:
          Fn::Join:
          - ''
          - - Ref: AWS::AccountId
            - .dkr.ecr.
            - Ref: AWS::Region
            - '.amazonaws.com/'
            - 'batchjob-ecr'
            - ':latest'
        Vcpus: 2
        Memory: 2000
      LogConfiguration:
        LogDriver: "awslogs"
        Options: {
          "awslogs-region": "${MY_AWS_REGION}",
          "awslogs-group": "/aws/batch/custom/env-queue"
        }
      RetryStrategy:
        Attempts: 1

属性 验证失败:[在 {/} 中遇到不受支持的属性:[LogConfiguration]]

LogConfiguration is part of ContainerProperties。所以看起来你的缩进是 不正确:

  BatchProcessingJobDefinition:
    Type: AWS::Batch::JobDefinition
    Properties:
      Type: container
      JobDefinitionName: 
        Fn::Join:
        - ''
        - - !Ref 'AWS::StackName'
          - '-BatchJobDefinition'
      ContainerProperties:
        Image:
          Fn::Join:
          - ''
          - - Ref: AWS::AccountId
            - .dkr.ecr.
            - Ref: AWS::Region
            - '.amazonaws.com/'
            - 'batchjob-ecr'
            - ':latest'
        Vcpus: 2
        Memory: 2000
        LogConfiguration:
          LogDriver: "awslogs"
          Options: {
            "awslogs-region": "${MY_AWS_REGION}",
            "awslogs-group": "/aws/batch/custom/env-queue"
          }
      RetryStrategy:
        Attempts: 1