如何解决Cloudformation AWS::Batch::JobDefinition 属性验证失败:[在 {/} 中遇到不受支持的属性:[LogConfiguration]]
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]]
解决方法
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。