Search code examples
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).

  • I know that the ephermal_storage property is in the right place in my call, as if I move it the SDK gives an error.
  • I know that the size_in_gi_b value is correct, as if I change it (e.g. size_in_gib) I also get an error.
  • I am running with platform version 1.4.0
  • There are no errors or warnings in Cloudwatch that the property can't be set e.g. (the task runs fine, just then runs out of disk space).
  • I can't find anything in the docs for how to fix this.

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
        }
      }
    })