I'm creating a POC with AWS Batch. To create the infra I'm ussing AWS CloudFormation.
I have a problem with the resource 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
Creating the stack fails with... "Property validation failure: [Encountered unsupported properties in {/ContainerProperties/Environment/0}: [name, value]]"
I read:
- 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
I tried this too:
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
Then I get "Property validation failure: [Encountered unsupported properties in {/ContainerProperties/Environment/0}: [SECRETS]]"
How is the syntax for this? I need more than one environment variable.
ContainerProperties:
Environment:
- name: SECRETS
value: '**********'
- name: SECRETS2
value: '**********'