【发布时间】:2021-04-16 04:53:08
【问题描述】:
我正在使用 AWS Batch 创建 POC。为了创建基础设施,我使用 AWS CloudFormation。
我的资源有问题 AWS::Batch::JobDefinition
ContentInputJob:
Type: "AWS::Batch::JobDefinition"
Properties:
Type: Container
ContainerProperties:
Environment:
- name: SECRETS
value: '**********'
Command:
- -v
- process
- new-file
- -o
Image: !Join ['', [!Ref 'AWS::AccountId','.dkr.ecr.', !Ref 'AWS::Region', '.amazonaws.com/', !Ref ImageName ] ]
JobRoleArn: !Ref BatchContainerIAMRole
Memory: 128
Vcpus: 2
JobDefinitionName: DemoContentInput
RetryStrategy:
Attempts: 1
创建堆栈失败并显示...“属性验证失败:[在 {/ContainerProperties/Environment/0} 中遇到不支持的属性:[名称,值]]”
我读到了:
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-containerproperties.html#cfn-batch-jobdefinition-containerproperties-environment
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-batch-jobdefinition-environment.html
我也试过这个:
ContentInputJob:
Type: "AWS::Batch::JobDefinition"
Properties:
Type: Container
ContainerProperties:
Environment:
- SECRETS: '**********'
Command:
- -v
- process
- new-file
- -o
Image: !Join ['', [!Ref 'AWS::AccountId','.dkr.ecr.', !Ref 'AWS::Region', '.amazonaws.com/', !Ref ImageName ] ]
JobRoleArn: !Ref BatchContainerIAMRole
Memory: 128
Vcpus: 2
JobDefinitionName: DemoContentInput
RetryStrategy:
Attempts: 1
然后我得到“属性验证失败:[在 {/ContainerProperties/Environment/0} 中遇到不支持的属性:[SECRETS]]”
这个的语法是怎样的?我需要多个环境变量。
ContainerProperties:
Environment:
- name: SECRETS
value: '**********'
- name: SECRETS2
value: '**********'
【问题讨论】:
标签: yaml amazon-cloudformation