Search code examples
amazon-ecs

AWS ECS Task Definition: Unknown parameter in volumes[0]: "dockerVolumeConfiguration", must be one of: name, host


I am trying to run Wazuh/Wazuh docker container on ECS. I was able to register task definition and launch container using Terraform. However, I am facing an issue with "Volume"(Data Volume) while registering tak definition using AWS CLI command.

Command: aws ecs --region eu-west-1 register-task-definition --family hids --cli-input-json file://task-definition.json

Error: ParamValidationError: Parameter validation failed: Unknown parameter in volumes[0]: "dockerVolumeConfiguration", must be one of: name, host 2019-08-29 07:31:59,195 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

{
"containerDefinitions": [
  {
    "portMappings": [
      {
        "hostPort": 514,
        "containerPort": 514,
        "protocol": "udp"

      },
     {
        "hostPort": 1514,
        "containerPort": 1514,
        "protocol": "udp"

      },
      {
        "hostPort": 1515,
        "containerPort": 1515,
        "protocol": "tcp"

      },
      {
        "hostPort": 1516,
        "containerPort": 1516,
        "protocol": "tcp"

      },
      {
        "hostPort": 55000,
        "containerPort": 55000,
        "protocol": "tcp"

      }
    ],
    "image": "wazuh/wazuh",
    "essential": true,
    "name": "chids",
    "cpu": 1600,
    "memory": 1600,
    "mountPoints": [
        {
          "containerPath": "/var/ossec/data",
          "sourceVolume": "ossec-data"

        },
        {
          "containerPath": "/etc/filebeat",
          "sourceVolume": "filebeat_etc"

        },
        {
          "containerPath": "/var/lib/filebeat",
          "sourceVolume": "filebeat_lib"

        },
        {
          "containerPath": "/etc/postfix",
          "sourceVolume": "postfix"
        }
      ]

  }
],
"volumes": [
  {
      "name": "ossec-data",
      "dockerVolumeConfiguration": {
      "scope": "shared",
      "driver": "local",
      "autoprovision": true
    }
  },
  {
    "name": "filebeat_etc",
    "dockerVolumeConfiguration": {
    "scope": "shared",
    "driver": "local",
    "autoprovision": true
    }
  },
  {
    "name": "filebeat_lib",
    "dockerVolumeConfiguration": {
    "scope": "shared",
    "driver": "local",
    "autoprovision": true
    }
  },
  {
    "name": "postfix",
    "dockerVolumeConfiguration": {
    "scope": "shared",
    "driver": "local",
    "autoprovision": true
  }
}
]   
}

I tried by adding "host" parameter(however it supports Bind Mounts only). But got the same error.

    "volumes": [
  {
      "name": "ossec-data",
      "host": {
      "sourcePath": "/var/ossec/data"
    },
      "dockerVolumeConfiguration": {
      "scope": "shared",
      "driver": "local",
      "autoprovision": true
    }
  }
]

ECS should register the task definition having 4 Data Volumes and associated mount points.


Solution

  • Got the issue. Removed "dockerVolumeConfiguration" parameter from "Volume" configuration and it worked.

    "volumes": [
    {
        "name": "ossec-data",
        "host": {
          "sourcePath": "/ecs/ossec-data"
        }
    
    },
    {
      "name": "filebeat_etc",
      "host": {
          "sourcePath": "/ecs/filebeat_etc"
        }
    
    },
    {
      "name": "filebeat_lib",
      "host": {
          "sourcePath": "/ecs/filebeat_lib"
        }
    
    },
    {
      "name": "postfix",
      "host": {
          "sourcePath": "/ecs/postfix"
        }
    

    } ]