Prerequisites

  • AWS CLI configured
  • Access to:
    • AWS ECR
    • AWS ECS (Fargate)
    • AWS CloudWatch
    • AWS VPC

Overview

This setup sends logs to Atatus, CloudWatch Logs and Loki using a Atatus Fluent Bit image.

Step 1: Create ECS Task Definition

Replace the following placeholders with your actual values: <YOUR_LOKI_NAME>, <YOUR_LOKI_HOST>, <YOUR_LOKI_PORT>, <YOUR_LOKI_TLS>, <YOUR_LOKI_TLS_VERIFY>, <YOUR_LOKI_HTTP_USER>, <YOUR_LOKI_HTTP_PASSWORD>, <YOUR_JOB_NAME>, <YOUR_ENVIRONMENT>, <YOUR_REGION>, <YOUR_CLOUDWATCH_LOG_GROUP_NAME>, <LOG_STREAM_PREFIX>, <YOUR_CONTAINER_NAME>, <YOUR_APP_IMAGE>, <YOUR_ATATUS_LOGS_INGEST_LICENSE_KEY>, <YOUR_SERVICE_NAME>, <YOUR_TASK_EXECUTION_ROLE>.
Sample Data for Placeholders: Use the below values as examples when replacing placeholders in your task definition:
  • <YOUR_LOKI_NAME> - loki
  • <YOUR_LOKI_HOST> - logs-prod-999.grafana.net
  • <YOUR_LOKI_PORT> - 443
  • <YOUR_LOKI_TLS> - on
  • <YOUR_LOKI_TLS_VERIFY> - on
  • <YOUR_LOKI_HTTP_USER> - 1100455
  • <YOUR_LOKI_HTTP_PASSWORD> - glc_eyJvIjoiMTM4NzYxMSIsIm4iOiJzdGFjay0xMjExODMz…
  • <YOUR_JOB_NAME> - ecs-app
  • <YOUR_ENVIRONMENT> - production
  • <YOUR_REGION> - ap-south-1
  • <YOUR_CLOUDWATCH_LOG_GROUP_NAME> - app-logs
  • <YOUR_LOG_STREAM_PREFIX> - ecs
  • <YOUR_CONTAINER_NAME> - my-app
  • <YOUR_APP_IMAGE> - 123456789012.dkr.ecr.us-east-1.amazonaws.com/my-app:latest
  • <YOUR_ATATUS_LOGS_INGEST_LICENSE_KEY> - lic_**********************
  • <YOUR_SERVICE_NAME> - test-service
  • <YOUR_TASK_EXECUTION_ROLE> - arn:aws:iam::123456789012:role/ecsTaskExecutionRole

Step 2: Deploy Task in ECS

  • Open ECS > Task Definitions in AWS Console
  • Register the new task definition using the JSON above.
  • Launch a task in a suitable Fargate cluster and subnet.

Verification

  • Atatus: Go to your Atatus Logs Dashboard and confirm logs are visible.
  • Grafana Loki: Log in to your Grafana Cloud account and navigate to Loki. Verify that the logs are being ingested successfully.
  • CloudWatch Logs: Navigate to your configured log group and confirm log ingestion.