Getting started / Add-Ons /
Sidecar

Sidecar

Overview

The Sidecar add-on adds a container of your choosing to your app’s task definition, running next to the primary app container. It shares the task’s network namespace, so the sidecar reaches your app on localhost, and it is stopped whenever the task stops.

Typical uses include log shippers, metrics exporters, proxies, and small helper daemons that need to run in the same task as your app.

Configuration

  • Name: used as the container name in the task definition. Lowercase letters, numbers and hyphens. Generated automatically if omitted.
  • Image: the docker image to run (required).
  • Command: optional shell command run as /bin/sh -c "<command>" instead of the image default.
  • Enabled: when disabled, the container is left out of newly created task definitions.
  • Applies to: whether the sidecar is added to all app processes, or only the default (web) process. Defaults to the default process only.
  • Depends on primary: when enabled, the sidecar only starts once the primary container reaches the configured condition.
  • Condition: START or HEALTHY. HEALTHY requires a healthcheck configured on the app process. AWS rejects SUCCESS and COMPLETE here because the primary container is essential.

The sidecar container is non-essential, so if it exits the task keeps running. It is allocated a small share of the task’s CPU and 128 MB of memory. Its logs go to the same CloudWatch log group as the app process.

Sidecar containers are added to app processes only, not to one-off tasks or consoles.

CLI Usage

Create Sidecar

Create a custom sidecar container that runs alongside your app container

tapit create sidecar image=IMAGE [name=NAME] [command=COMMAND] [enabled=true|false] [all_processes=true|false] [depends_on_primary=true|false] [depends_on_condition=START|HEALTHY] [--ignore-existing]

Parameters

  • name: Container name for the sidecar (optional, generated if omitted)
  • image: Docker image to run as the sidecar container (required)
  • command: Shell command to run in the container instead of the image default
  • enabled: Whether the sidecar is included in deployments (true/false, default true)
  • all_processes: Add the sidecar to all app processes, instead of only the default process (true/false, default false)
  • depends_on_primary: Start the sidecar only after the primary container (true/false, default false)
  • depends_on_condition: Dependency condition on the primary container: START/HEALTHY (default START). SUCCESS and COMPLETE are not allowed because the primary container is essential
  • --ignore-existing: Skip creation if a resource with the same name already exists (useful for idempotent scripts)

Update Sidecar

Update settings for an existing sidecar container add-on

tapit set sidecar name=addon_name [image=IMAGE] [command=COMMAND] [enabled=true|false] [all_processes=true|false] [depends_on_primary=true|false] [depends_on_condition=START|HEALTHY]

Parameters

  • name: Name of the sidecar add-on to update (required)
  • image: Docker image to run as the sidecar container (required)
  • command: Shell command to run in the container instead of the image default
  • enabled: Whether the sidecar is included in deployments (true/false, default true)
  • all_processes: Add the sidecar to all app processes, instead of only the default process (true/false, default false)
  • depends_on_primary: Start the sidecar only after the primary container (true/false, default false)
  • depends_on_condition: Dependency condition on the primary container: START/HEALTHY (default START). SUCCESS and COMPLETE are not allowed because the primary container is essential

Web UI

  1. Navigate to your app.
  2. Go to the Add-ons section.
  3. Click “Add Add-on” and select “Sidecar”.
  4. Enter the container name, image, and optional command, and set the dependency options.
  5. Click Create.

Changes trigger a redeploy so the new task definition takes effect.

Deleting the Add-On

Removing the add-on removes the container from subsequent task definitions. Redeploy the app to drop it from running tasks.