Task definition causing deploy errors for AWS ECS
Asked by AdamClarey:

I copied the task definition JSON from the actual task definition I created in the AWS console.

I pasted this this JSON into the file task-definition.json file in my repo.

I then tried to run the deploy pipe as described here:

<https://bitbucket.org/atlassian/aws-ecs-deploy/src/master/>

but it spits out a whole bunch of errors like below. In my task-definition for example, compatibilities is:

"compatibilities": \[

"EC2",

"FARGATE"

\],

Unknown parameter in input: "compatibilities", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAcceleratorsUnknown parameter in input: "taskDefinitionArn", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAcceleratorsUnknown parameter in input: "requiresAttributes", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAcceleratorsUnknown parameter in input: "revision", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAcceleratorsUnknown parameter in input: "status", must be one of: family, taskRoleArn, executionRoleArn, networkMode, containerDefinitions, volumes, placementConstraints, requiresCompatibilities, cpu, memory, tags, pidMode, ipcMode, proxyConfiguration, inferenceAcceleratorsInvalid type for parameter ipcMode, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter containerDefinitions[0].dnsSearchDomains, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].environmentFiles, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].logConfiguration.secretOptions, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].entryPoint, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].command, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].linuxParameters, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>Invalid type for parameter containerDefinitions[0].resourceRequirements, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].ulimits, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].dnsServers, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].workingDirectory, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter containerDefinitions[0].secrets, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].dockerSecurityOptions, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].memory, value: None, type: <class 'NoneType'>, valid types: <class 'int'>Invalid type for parameter containerDefinitions[0].stopTimeout, value: None, type: <class 'NoneType'>, valid types: <class 'int'>Invalid type for parameter containerDefinitions[0].startTimeout, value: None, type: <class 'NoneType'>, valid types: <class 'int'>Invalid type for parameter containerDefinitions[0].firelensConfiguration, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>Invalid type for parameter containerDefinitions[0].dependsOn, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].disableNetworking, value: None, type: <class 'NoneType'>, valid types: <class 'bool'>Invalid type for parameter containerDefinitions[0].interactive, value: None, type: <class 'NoneType'>, valid types: <class 'bool'>Invalid type for parameter containerDefinitions[0].healthCheck, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>Invalid type for parameter containerDefinitions[0].links, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].hostname, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter containerDefinitions[0].extraHosts, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].pseudoTerminal, value: None, type: <class 'NoneType'>, valid types: <class 'bool'>Invalid type for parameter containerDefinitions[0].user, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter containerDefinitions[0].readonlyRootFilesystem, value: None, type: <class 'NoneType'>, valid types: <class 'bool'>Invalid type for parameter containerDefinitions[0].dockerLabels, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>Invalid type for parameter containerDefinitions[0].systemControls, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter containerDefinitions[0].privileged, value: None, type: <class 'NoneType'>, valid types: <class 'bool'>Invalid type for parameter taskRoleArn, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter pidMode, value: None, type: <class 'NoneType'>, valid types: <class 'str'>Invalid type for parameter inferenceAccelerators, value: None, type: <class 'NoneType'>, valid types: <class 'list'>, <class 'tuple'>Invalid type for parameter proxyConfiguration, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>


Answers:
author: Jason Harrison
body: atlassian/aws-ecs-deploy needs just the subset of the task-definition.json

All of those keys it is complaining about should be removed.

comments: author: Halyna Berezovska
body: [@Jason Harrison](/t5/user/viewprofilepage/user-id/4055349) yes, but this depends on the task definition structure, and pipe is not forming this structure, it is passing it just as you're passing it to the pipe. You can validate your task definition first. Also please share traceback from the pipe exactly, from the trace above I don't see where exactly the pipe failing and which aws command is throwing this traceback, because the traceback you shared is from aws cli .

This will help us a lot to find your failing root cause


author: Jason Harrison
body: [@Halyna Berezovska](/t5/user/viewprofilepage/user-id/3865505)I think you wanted to target the second half of your message to [@AdamClarey](/t5/user/viewprofilepage/user-id/2022958)


author: Halyna Berezovska
body: [@Jason Harrison](/t5/user/viewprofilepage/user-id/4055349) oh sorry!


author: Halyna Berezovska
body: [@AdamClarey](/t5/user/viewprofilepage/user-id/2022958) could please share the line where pipe is failing (this part of logs in pipeline) and part of structure of your task definition?

In the doc I see that compatibilities should be mentioned like

```
requiresCompatibilities=[        'EC2'|'FARGATE',    ],
```

See <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.register_task_definition>

Regards, Galyna


Tags: aws

bitbucket-pipelines

server