moto icon indicating copy to clipboard operation
moto copied to clipboard

ECS task definition cpu/memory

Open ipmb opened this issue 4 years ago • 2 comments

refs #3222

The rules around this are a little confusing. I haven't covered all the use cases, but I think this is an improvement.

Going from https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.htm

Task Definition

When you register a task definition, you can specify the total cpu and memory used for the task. This is separate from the cpu and memory values at the container definition level. If using the EC2 launch type, these fields are optional. If using the Fargate launch type, these fields are required and there are specific values for both cpu and memory that are supported.

Container Definition

cpu

This field is optional for tasks using the Fargate launch type, and the only requirement is that the total amount of CPU reserved for all containers within a task be lower than the task-level cpu value.

memory

The total amount of memory reserved for all containers within a task must be lower than the task memory value, if one is specified.

If using the Fargate launch type, this parameter is optional.

If using the EC2 launch type, you must specify either a task-level memory value or a container-level memory value. If you specify both a container-level memory and memoryReservation value, memory must be greater than memoryReservation. If you specify memoryReservation, then that value is subtracted from the available memory resources for the container instance on which the container is placed. Otherwise, the value of memory is used.

memoryReservation

If a task-level memory value is not specified, you must specify a non-zero integer for one or both of memory or memoryReservation in a container definition. If you specify both, memory must be greater than memoryReservation. If you specify memoryReservation, then that value is subtracted from the available memory resources for the container instance on which the container is placed. Otherwise, the value of memory is used.

ipmb avatar Aug 28 '20 17:08 ipmb

@ipmb Hi there. This had gone a bit stale. I brought in the latest changes from master and re-ran CI. The tests are still failing based on some of the changes you introduced. Please let us know if you're still interested in working on this or if you've moved on. Thanks.

bpandola avatar Nov 10 '22 02:11 bpandola

Thanks @bpandola! I am still interested (I maintain this patch locally), but time has been hard to come by. I'll do my best.

ipmb avatar Nov 10 '22 16:11 ipmb