Skip to content

Shared Task Attributes

The attributes below are available in the following sections:

Usage

task_defaults:
  cpu: 1024
  <something from Fields>: value
task_defaults:
  cpu: 1024

services:
  - name: web
    <something from Fields>: value

  - name: important-jobs
    cpu: 4096
    memory: 4x
cronjobs:
  - name: reaper
    ...
    <something from Fields>: value
predeploy:
  - name: dbmigrate
    ...
    <something from Fields>: value
console:
  enabled: true
  ...
  <something from Fields>: value

Fields

arch

Override the architecture of this task. Values are amd64 or arm64.

Default: amd64

command

See Command/Entry Point

cpu

How many CPU shares are given to the task

See CPU/Memory Resources

Default: 1024

credentials

See Private Registry

entrypoint

See Command/Entry Point

environment

Allows extra task-specific environment variables to be added.

See Environment Variables

image

Allows you to override the image used for this task. See Image Documentation

labels

Add Docker Labels. Same structure as in the Tags Documentation.

memory

See CPU/Memory Resources

Default: 2x

mounts

Specify mount points. See Volumes/Mounts.

network

Override network settings. See Network

platform_version

Override the Fargate Platform Version.

Default: LATEST

proxy

See Proxy Configuration

start_timeout

See Start/Stop Timeouts

stop_timeout

See Start/Stop Timeouts

storage

Amount of storage to attach to the cluster (in GiB)

See AWS Documentation on Fargate Storage

healthcheck

See Container Health Checks

tags

Additional tags to apply to this task. Same format as in the Tags Documentation.

ulimits

Specify limit overrides per container. See Ulimits for more details.

user

Override the user to run your container as. Specify as username or UID or UID:GID.

volumes

Specify volumes that can be mounted. See Volumes/Mounts.

workdir

Override the working directory to run your container in.


CPU/Memory Resources

cpu

CPU Shares specified as an integer. 1 cpu core is equal to 1024 shares.

memory

Memory allocation for the task. Can be specified in multiple ways:

  • An integer, denoting megabytes (ex: 4096)
  • A multiplier of CPU shares in the format of #.#x (ex: 2x or 0.25x)
  • As gigabytes with the format of #.# GB (ex: 8GB or 0.5 GB)

Warning

Fargate places restrictions on the allowable CPU/Memory requirements. (See more on Fargate task sizes)

If you specify CPU/Memory combinations that do not exist on Fargate, the deployer will automatically pick the smallest size that will contain the CPU/Memory requirements you have specified.

Example: If you specify cpu=512/memory=7000, then the deployer will use cpu=1024,memory=7168 as that is the smallest Fargate size that meets the requirements.


Command/Entry Point

Commands and EntryPoints can be specified in two ways:

command: ["bundle", "exec", "puma", "-c", "config/puma.rb"]
command: "bundle exec puma -c config/puma.rb"

Warning

Commands are always represented as an array of strings. If you provide it as a string, that string will be split into an array, (possibly incorrectly). For that reason we recommend you only use the Array based method for specifying commands.

Also: Environment/Shell interpolation is not available on ECS. Do not use environment references in your commands.


Start/Stop Timeouts

start_timeout

How long ECS will wait for your container to start before giving up.

Note that this is for container dependency resolution. You probably do not need to modify this

stop_timeout

Time to wait before the container is forcefully killed if it doesn't exit normally on its own, when requested to terminate.

Note that for spot containers, they will be killed after 2 minutes regardless of what you put here.

You can specify all durations as either seconds (as an integer) or using Go Duration Format (eg 2m or 30s)


Container Health Checks

Warning

AWS recommends that you do not use a docker health check

For the official documentation on specifying health checks, see AWS ECS HealthCheck Documentation

command - (required)

The command to be run for the healthcheck. You must specify this as an array of strings, with the first element being either CMD or CMD-SHELL.

See ECS HealthCheck Command Docs

interval

The time period in seconds between each health check execution.

retries

The number of times to retry a failed health check before the container is considered unhealthy.

start_period

The optional grace period to provide containers time to bootstrap before failed health checks count towards the maximum number of retries.

timeout

The time period in seconds to wait for a health check to succeed before it is considered a failure.


Ulimits

Specify ulimits as an array of objects with the following properties:

name - (required)

The name of the ulimit to adjust. Possible values are shown in the AWS ECS Documentation. Note that Fargate may not allow you to adjust all ulimits.

soft

The value for the soft limit. Specified as an integer.

hard

The value for the hard limit. Specified as an integer.


Proxy Configuration

You must specify the proxy container as a sidecar. If you do not specify it, then your tasks will fail.

task_defaults:
  proxy:
    container: envoy
    properties:
      AppPorts: 5000
      IgnoredUID: 1000
      ...
proxy: false
type

The only acceptable value for this is APPMESH. This is the default, so it's recommended that you just leave this blank.

Default: APPMESH

container

The name of the container that is providing the proxy.

Default: envoy

properties - (required)

The properties for the proxy configuration.

You can use the same syntax used for defining environment variables, except you cannot specify any SSM parameters.

For a list of properties, see the AWS ECS ProxyConfiguration docs.

Default: empty (You must provide the required properties)

disabled

If this is true, then the proxy configuration will be disabled for this task.

Default: false


Private Registry

You can utilize ECS to connect to a private registry by providing the ARN of a SecretsManager secret for the credentials key.

This is normally not needed. If you are using ECR to host images, you do not need this. If you are unsure if you need this, then you don't need it.

For more details, look at the AWS documentation for Private registry authentication for tasks