AWS CloudFormation UserGuide for AWS::Batch::JobDefinition 说有 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]]
答案 0 :(得分:0)
LogConfiguration 是 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