aws / amazon-ecs-cli

The Amazon ECS CLI enables users to run their applications on ECS/Fargate using the Docker Compose file format, quickly provision resources, push/pull images in ECR, and monitor running applications on ECS/Fargate.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html
Other
1.78k stars 303 forks source link

Allow specifying container parameters (cpu, memory) using ecs params #1149

Open wralph opened 2 years ago

wralph commented 2 years ago

With the current version of the ecs-cli (1.21.0) it is possible to specify CPU / memory requirements for the task but not for the actual container. This has an impact for Windows based containers as the default CPU value for a container is 0. This results in the container getting only 1% CPU cycles of the specified task CPU configuration as described in the documentation

On Windows container instances, the CPU limit is enforced as an 
absolute limit, or a quota. Windows containers only have access
 to the specified amount of CPU that is defined in the task definition. 
A null or zero CPU value is passed to Docker as 0, which Windows 
interprets as 1% of one CPU.

At the time of opening this issue, the documentation is not describing a possibility to specify the container CPU values.

Configurations used

The used service configuration:

version: '3'
services:
  auth:
    image: ralphw/ecs-lab4:windowsservercore-ltsc2019
    ports:
      - "80:80"
    security_opt: 
      - credentialspec:$credspec_param_arn

The ecs-params file:

version: 1
task_definition:
  ecs_network_mode: awsvpc
  task_execution_role: gmsa-task-execution-role
  task_size:
    mem_limit: 1024
    cpu_limit: 512 
run_params:
  network_configuration:
    awsvpc_configuration:
      subnets: 
        - $private_subnet3
        - $private_subnet4
      security_groups: 
        - $task_securitygroup_id
      assign_public_ip: DISABLED

The command to create the service

ecs-cli compose `
  --file auth-service.yml `
  --project-name auth-service `
  --ecs-params ecs-params.yml `
  service up `
  --target-group-arn $target_group_arn `
  --container-name auth `
  --container-port 80 `
  --timeout 10 `
  --cluster workshop-cluster

Context

I am trying to run Windows containers and am affected with containers getting not enough CPU resources to start properly.

Alternatives

A workaround is to use the aws cli and specify the task definition in the "traditional" way as there is a possibility to specify the container parameters.


This is a :rocket: Feature Request

hqtoan94 commented 1 year ago

My one is with memory, I can't specify mem_limit for the container and then it always set to 512 which really inconvenient