0

The following CloudFormation script creates a task definition but does not seem to create the container definition correctly. Can anyone tell me why?

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Test stack for troubleshooting task creation",
"Parameters": {
    "TaskFamily": {
        "Description": "The task family to associate the task definition with.",
        "Type": "String",
        "Default": "Dm-Testing"
    }
},
"Resources": {
    "TaskDefinition": {
        "Type": "AWS::ECS::TaskDefinition",
        "Properties": {
            "Family": {
                "Ref": "TaskFamily"
            },
            "RequiresCompatibilities": [
                "EC2"
            ],
            "ContainerDefinitions": [
                {
                    "Name": "sample-app",
                    "Image": "nginx",
                    "Memory": 200,
                    "Cpu": 10,
                    "Essential": true,
                    "Environment": [
                        {
                            "Name": "SOME_ENV_VARIABLE",
                            "Value": "SOME_VALUE"
                        }
                    ]
                }
            ]
        }
    }
}
}

When I view the created task, there is no container listed in the builder view of task definition in aws.

Task Definition

The information is listed, however, under the json tab of the task definition:

Json View Of container definitions

Note that the above image is a subset of the info shown, not all of it.

The result of this is that, when the task is run in a cluster, it does run the image, but runs it without the environment variables applied. In addition, CF does not report any errors when creating this stack, or when running the created task.

Finally, the CloudFormation script is a cut down example of the 'real' script which has started exhibiting this same issue. That script has been working fine for around a year now, and, as far as I can see, there have been no changes to the script between it working and breaking.

I would greatly appreciate any thoughts or suggestions on this because my face is beginning to hurt from smashing it against this particular wall.

3
  • I think this is some bug O_o I'm getting the same error, but the ECS Service launching the task definition works perfectly fine. Commented May 28, 2019 at 6:25
  • @SleeperSmith Thanks for looking at this, at least i know its not me =) I've raised this with amazon. They can recreate the behaviour and are investigating. I'll update this when they come back to me. Commented May 28, 2019 at 10:59
  • How did you update your task definition, when i update my stack it deregisters the current task definition and makes it inactive. There is only one task definition which is active at any time when i use CFT. Commented Oct 11, 2020 at 17:11

1 Answer 1

0

Turns out this was a bug in cloudformation that only occurred when creating a task definition using a script through the aws console. Amazon have now resolved this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.