OdigosFargateInstrumentation instruments containers running in ECS Fargate services defined in your CDK
app.
Read Odigos AWS CDK first — it covers
installing the package and how Odigos recognizes an instrumented workload — then
Destinations for the shared
destination
options. This page covers only what’s specific to Fargate.Basic usage
instrument() for each container you want instrumented. There’s
no automatic sweep of a whole stack — you name each container explicitly.
How it works
The construct sets up four things that work together:- A shared scratch volume on the task definition, named
odigos-agent. - An extra container, also named
odigos-agent, that copies the right language agent into that volume and then exits. It’s marked non-essential, because finishing and exiting is its whole job — it isn’t part of your running application. - A read-only mount of that volume at
/var/odigosin your application container, which is set to wait until the copy step has finished successfully before it starts. - Environment variables on your application container that load the agent and configure where telemetry goes.
Where telemetry goes
Straight from your application to your destination. There’s no intermediate collector inside the task, so your application’s own OpenTelemetry exporter is what makes the network call — which means a slow or unreachable destination is felt by the application itself. Two practical consequences: the destination endpoint has to be reachable from the task’s network, and it’s worth pointing it somewhere with headroom, since your application is doing the sending.Stating the language
OdigosFargateLanguage
required
One of
JAVA, PYTHON, NODEJS, DOTNET, PHP, RUBY.
There’s no auto-detection here, and that’s a platform constraint rather than a preference. A container
declares only an image — nothing in the task definition says which language runs inside it. Working that
out would mean downloading and inspecting the image, which is network I/O a build can’t do. So you state it.
string
Your application’s language version as
major.minor — for example "8.3" or "3.3". Required for PHP
and Ruby (their agents are laid out per version in the bundle). Ignored for Java, Python, Node.js, and
.NET — those ship one agent that covers a range of runtime versions, so you don’t declare which one.Go can’t be instrumented on Fargate at all — not an omission, a platform
limit. Go’s only zero-code instrumentation is eBPF-based, and Fargate doesn’t
allow the privileged access eBPF needs. Use the OpenTelemetry Go SDK in your code
instead.
Naming your service
OTEL_SERVICE_NAME here must be the ECS service’s name — not the task definition family, and not the
container name. Odigos compares it against the workload’s name, and a mismatch is reported as drift rather
than treated as a naming preference. There’s no default, so you set one of these two:
ecs.BaseService
The ECS service running this task definition. Only its name is read.
string
The name directly — use this when the service is defined somewhere else (another stack, Terraform, or the
console).
Variables your container already sets
For Java, Node.js, and Python, the construct reads whatever your container already has in its loader variable and adds to it — joined by that language’s separator (a space for Java and Node.js, a colon for Python):string
Only needed as an override — pass this when the existing value isn’t visible to CDK at build time,
because it comes from an
environmentFiles entry, the image’s own ENV, or secrets.Transport
Fargate accepts both endpoint formats at once, and often should get both:Instrumenting several containers
A task definition holding more than one application — in more than one language — is a normal shape. Callinstrument() once per container, or use instrumentAll():
AWS allows at most 10 containers per task definition, and the copy step needs one
of them. A task definition already at the limit stops the build, rather than
failing later during deployment.
The agents image
The copy step pulls its files from an image. Leave this unset unless your tasks cannot reach the public registry — the construct defaults toregistry.odigos.io/odigos-fargate-agents at the tag this package
release ships (multi-arch: Intel and ARM/Graviton).
string
Only set this if tasks cannot pull from See Preload the Fargate agents image for how to build
that mirror.
registry.odigos.io (or your org requires images to live in a
registry you own). Point the copy step at your own mirror:/instrumentations/<language>/…). The construct sets environment variables that point at those exact
paths after the copy step stages them into /var/odigos. A private-registry override must therefore be a
byte-for-byte mirror of that image — retag and push the published odigos-fargate-agents image; do not
rebuild or rearrange it. See Preload the Fargate agents image
for the mirror steps (and Amazon ECR private registries
if you need the AWS side of hosting it).
The agents themselves are Linux and glibc only: a Windows task definition stops the build, and Alpine/musl
application images have no .NET profiler available.
Whichever image you use is recorded in the ODIGOS_IAC marker, and Odigos holds the task to that image
rather than to whatever the connector’s own build happens to use. Two useful consequences:
- Your mirror is judged against itself, not flagged for differing from the default.
- Upgrading this package ahead of the connector isn’t drift either — the service stays conformant until you redeploy.
What is reported: two containers in the same task definition recording different
agents images. There’s one copy step and it can’t stage two different images.
API reference
Next steps
CDK overview
Install, constructs, and how Odigos recognizes instrumented workloads.
Destinations
Endpoint formats, credentials, and which signals to enable.
Preload the agents image
Mirror the image into a registry your tasks can reach.