rubyamazon-web-servicesaws-fargateaws-sdk-ruby

How to configure ephemeral storage on ECS Fargate Task via Ruby SDK?


I'm using the Ruby SDK for AWS ECS to kick-off a task hosted in Fargate via run_task method. This all works fine with the defaults — I can kick off the task OK and can send along custom command parameters to my Docker container:

client = Aws::ECS::Client.new(region: region)
client.run_task({
  cluster: fargate_cluster_name,
  task_definition: task_definition,
  launch_type: 'FARGATE',
  network_configuration: {
    awsvpc_configuration: {
      subnets: my_subnets,
        security_groups: my_security_groups,
        assign_public_ip: 'ENABLED',
      },
  },
  overrides: {
    container_overrides: [
      {
        name: my_container_name,
        command: command_params
      }
    ]
  }
})

For some runs, I need a large disk size than the default & want to set this via the ephemeral_storage parameter in the SDK. I've tried this:

client = Aws::ECS::Client.new(region: region)
client.run_task({
  cluster: fargate_cluster_name,
  task_definition: task_definition,
  launch_type: 'FARGATE',
  network_configuration: {
    awsvpc_configuration: {
      subnets: my_subnets,
        security_groups: my_security_groups,
        assign_public_ip: 'ENABLED',
      },
  },
  overrides: {
    container_overrides: [
      {
        name: my_container_name,
        command: command_params
      }
    ],
    ephemeral_storage: {
      size_in_gi_b: 200
    }
  }
})

But it doesn't work (I'm running df -H within my entrypoint and can see that the storage doesn't increase).

How should ephemermal storage be set for ad hoc task execution via the Ruby SDK? (I'm looking for the SDK equivalent to this blogpost by AWS, rather than an alternative solution e.g. mounting EFS or running via EC2)


Solution

  • This was a bug of the SDK, now fixed (server-side, so doesn't require a library update).

    The block of code in the question is the correct way for increasing ephemeral storage via the Ruby SDK:

    client.run_task({
      # ...
      overrides: {
        # ...
        ephemeral_storage: {
          size_in_gi_b: 200
        }
      }
    })