【问题标题】:Cloudformation AWS::Batch::JobDefinition Property validation failure: [Encountered unsupported properties in {/}: [LogConfiguration]]Cloudformation AWS::Batch::JobDefinition 属性验证失败:[在{/}中遇到不支持的属性:[LogConfiguration]]
【发布时间】:2021-05-31 13:36:09
【问题描述】:

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

属性验证失败:[Encountered unsupported properties in {/}: [LogConfiguration]]

【问题讨论】:

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


    【解决方案1】:

    LogConfigurationContainerProperties 的一部分。因此,您的缩进似乎不正确

      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 是 ContainerProperties 的一部分吗? UserGuide 将 LogConfiguration 显示为单独的一个。
    • @YerzhanKaskabay 没问题。最好查看和 cloudformation 文档。
    • 我从文档中犯了同样的错误,这似乎是工作定义的一部分
    猜你喜欢
    • 2019-11-02
    • 2020-09-20
    • 2018-08-11
    • 2018-10-13
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 2020-06-03
    • 1970-01-01
    相关资源
    最近更新 更多