Skip to content

ECS Agent

  • Runs as a Daemon (EC2) or sidecar container (Fargate) alongside your workloads.
  • Tracks task definitions, services, capacity providers, CPU/memory reservations, and CloudWatch usage.
  • Emits spend per task, service, environment, and tenant labels so you can compare EC2 vs Fargate costs.
  • Daemon scheduling: create a dedicated ECS service with DAEMON strategy so one agent runs on every container instance.
  • Sidecar: add the agent container to existing Fargate task definitions with essential: false.
  • Permissions: attach an IAM policy allowing ecs:Describe*, cloudwatch:GetMetricData, and pricing:GetProducts.
ENV / FlagDescription
CLUSTERCOST_CLUSTERHuman-friendly name for charts and SaaS aggregation.
CLUSTERCOST_SERVICEOptional override to tag spend with a logical service name.
AWS_REGIONRegion used when querying CloudWatch/Pricing endpoints.
TENANT_LABELSComma-separated metadata (team, project, client) forwarded to the dashboard/SaaS.

Use secrets or task definition environment overrides for sensitive data such as API tokens or custom endpoints.