Srinivasa Tadipatri
Srinivasa Tadipatri

Reputation: 47

aws Batch Jobdefinition Cloudfromation error

I am getting the following error Property validation failure: [Encountered unsupported properties in {/ContainerProperties}: [environment, user, command]]

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "AWS Batch Refarch - Unmanaged ECS cluster",
    "Parameters": {
        "JobDefinitionName": {
            "Description": "Job Definition",
            "Type": "String"
        },
        "ContainerBootstrapCommand1": {
            "Description": "Enter the Job Name",
            "Type": "String",
            "Default": "myjob.sh"
        },
        "ContainerBootstrapCommand1Timeout": {
            "Description": "Choose a subnet to which this ECS cluster should be deployed",
            "Type": "String",
            "Default": "60"
        },
        "ImageContainer": {
            "Description": "Enter the ARN Name for the container image",
            "Type": "String",
            "Default": "848282188376513.dkr.ecr.us-east-1.amazonaws.com/awsbatch/fetch_and_run"
        },
        "JobRole": {
            "Description": "Enter the ARN Name for the container image",
            "Type": "String",
            "Default": "arn:aws:iam::848282188376513:role/batchJobRole"
        }
    },
    "Resources": {
        "JobDefinition": {
            "Type": "AWS::Batch::JobDefinition",
            "Properties": {
                "Type": "container",
                "JobDefinitionName": {
                    "Ref": "JobDefinitionName"
                },
                "ContainerProperties": {
                    "Image": {
                        "Ref": "ImageContainer"
                    },
                    "Vcpus": 4,
                    "Memory": 2000,
                    "command": [
                        {
                            "Ref": "ContainerBootstrapCommand1"
                        },
                        {
                            "Ref": "ContainerBootstrapCommand1"
                        }
                    ],
                    "JobRoleArn": {
                        "Ref": "JobRole"
                    },
                    "environment": [
                        {
                            "name": "BATCH_FILE_S3_URL",
                            "value": "s3://mybucket/myjob.sh"
                        },
                        {
                            "name": "BATCH_FILE_TYPE",
                            "value": "script"
                        }
                    ],
                    "ReadonlyRootFilesystem": true,
                    "Privileged": true,
                    "user": "nobody"
                }
            }
        }
    }
}

Upvotes: 1

Views: 545

Answers (1)

MaiKaY
MaiKaY

Reputation: 4482

You have only small typos within your teamplate.

The properties needs to be called Command and not command, Environment and not environment, User and not user,

Check the documentation for more details

(If you read the error message carefully you would have tackled this issue by your own)

Upvotes: 3

Related Questions