Setting ulimit stack size in Terraform's aws_ecs_task_definition resource

Viewed 2565

I need to increase the stack size in my ECS tasks.

Does aws_ecs_task_definition support ulimit stack size? If it does whats the syntax?

1 Answers

ulimit and other resource limits can be set in the container definitions for each container in a task. This is shown in the AWS User Guide for ECS task definitions and is analogous to --ulimit in the docker run command.

To set a ulimit for your container in a task definition you'll want something like the following for your container definitions:

[
  {
    "name": "first",
    "image": "service-first",
    "cpu": 10,
    "memory": 512,
    "essential": true,
    "ulimits": [
      {
        "name": "stack",
        "softLimit": 8192,
        "hardLimit": 16384
      }
    ]
    "portMappings": [
      {
        "containerPort": 80,
        "hostPort": 80
      }
    ]
  }
]
Related