# AWS Fargate Observability with qryn.cloud

![What is AWS Fargate | AWS Fargate vs EC2 | Benefits - K21 ...](https://k21academy.com/wp-content/uploads/2022/11/download-1.jpg align="left")

**AWS Fargate** is a *serverless, pay-as-you-go compute engine* that lets you focus on building and operating applications without managing servers.

AWS Fargate works with **Amazon ECS** and **EKS** to run [containers](https://aws.amazon.com/what-are-containers) without having to manage servers or clusters of Amazon EC2 instances. Users no longer have to provision, configure, or scale clusters of virtual machines to run containers, removing the need to choose server types or decide when to scale or optimize clusters.

### ⚡ Serverless Monitoring Challenge

Due to their dynamic nature, Serverless setups can be challenging to monitor and troubleshoot without a centralized and well-coordinated **observability** solution. Once things scale up, it gets incrementally harder to comprehend how all workloads are performing and how they are utilizing and affecting your AWS resources over time.

*Fear not!* Here's a collection of **qryn-compatible agents** to get you started in minutes!

### Requirements:

* **AWS Fargate**
    
* [**qryn.cloud**](http://qryn.cloud) *account or* [***free trial***](https://qryn.cloud/)
    
* **Collector Agent** *of choice:*
    
    * **Grafana Agent** *from Grafana*
        
    * **Telegraf** *from Influxdata*
        
    * **Vector** *from Datadog*
        

---

![grafana/agent 简介: Telemetry agent for the LGTM stack. - GitHub中文社区](https://www.githubs.cn/raw-githubusercontent/grafana/agent/main/docs/sources/assets/logo_and_name.png align="left")

### Grafana **Agent**

**Grafana Agent** collects and sends **metrics, logs, and traces** from your Fargate instances directly to [**qryn.cloud**](https://qryn.cloud) and allows users and administrators to instantly observe the critical metrics, logs, and traces using the onboard Grafana. 

Since [qryn](http://qryn.cloud) is transparently compatible with Loki, Prometheus and Tempo APIs (out of many more) using ClickHouse storage, everything just works out of the box!

**Steps:**

1. Configure [**Grafana Agent** YAML](https://qryn.metrico.in/#/logs/ingestion?id=grafana) to send Logs, Metrics and Traces to [qryn](https://qryn.cloud)
    
2. Deploy <mark>Grafana Agent</mark> on your **Fargate** cluster as a sidecar
    

🎉*You're done!* No need to worry about any extra steps or configuration options after configuring your Grafana Agent `YAML` file - the agent will deliver *metrics, logs, and traces* to your qryn stack automatically.

---

![Upgrading Telegraf on Debian Linux - Homelab Rat](https://i1.wp.com/homelabrat.com/wp-content/uploads/2018/07/telegraflogo.png?ssl=1 align="left")

### Telegraf

**Telegraf** is a popular observability agent from InfluxData, supporting multiple native **qryn API** standards such as *Influx Line Protocol, Loki, Prometheus and others.*

Telegraf Agents can collect, generate and sends **metrics, logs, and traces** from your instances and supports writing directly to [**qryn.cloud**](https://qryn.cloud).

The [**Amazon ECS Fargate compatible**](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/ecs/README.md) `input plugin` automatically uses the Amazon ECS metadata and stats [v2](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v2.html) or [v3](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v3.html) API endpoints to gather stats on running containers.

```yaml
# Read metrics about ECS containers
[[inputs.ecs]]
  ## ECS metadata url.
  # endpoint_url = ""

  ## Containers to include and exclude. Globs accepted.
  ## Note that an empty array for both will include all containers
  # container_name_include = []
  # container_name_exclude = []

  ## Container states to include and exclude. Globs accepted.
  ## When empty only containers in the "RUNNING" state will be captured.
  ## Possible values are "NONE", "PULLED", "CREATED", "RUNNING",
  ## "RESOURCES_PROVISIONED", "STOPPED".
  # container_status_include = []
  # container_status_exclude = []

  ## ecs labels to include and exclude as tags.  Globs accepted.
  ## Note that an empty array for both will include all labels as tags
  ecs_label_include = [ "com.amazonaws.ecs.*" ]
  ecs_label_exclude = []

[[outputs.influxdb_v2]]
  urls = ["https://account.qryn.cloud/influx/api/v2/write"]
  token = "$AUTH_TOKEN"
  organization = "example-org"
  bucket = "example-bucket"
```

**Steps:**

1. Configure **Telegraf** to send [ECS Telemetry](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/ecs/README.md) data to [qryn](https://qryn.cloud)
    
2. Deploy <mark>Grafana Agent</mark> on your **Fargate** cluster as a sidecar
    

🎉*You're done!* No need to worry about any extra steps or configuration options. The Telegraf agent will deliver *metrics, logs, and traces* to your qryn stack automatically.

---

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678531742406/7c91b528-7fc6-48a4-b224-0d51d726e4c5.png align="left")

### Vector

**Vector** is a polyglot observability agent from Datadog, supporting multiple qryn API standards such as Loki, Prometheus and others, and packaged as a single binary with no dependencies, no runtime, and memory safe. [Vector Configuration](https://vector.dev/docs/reference/configuration/) can be performed using YAML, TOML or JSON format.

*Let's configure Vector to look after our AWS Fargate containers:*

**Steps:**

1. Configure Vector for [AWS ECS and Fargate Metrics](https://vector.dev/docs/reference/configuration/sources/aws_ecs_metrics/) with output to [qryn](https://qryn.cloud)
    
2. Deploy <mark>Vector</mark> on your **Fargate** cluster as a sidecar
    

```toml
[sources.fargate]
type = "aws_ecs_metrics"

[sinks.qryn_metrics]
type = "prometheus_remote_write"
inputs = [ "fargate" ]
endpoint = "https://account.qryn.cloud/api/v1/write"
auth.strategy = "basic"
auth.user = "cloud_username"
auth.password = "cloud_token"

[sinks.qryn_logs]
type="loki"
inputs = ["fargate"]
endpoint = "https://account.qryn.cloud"
auth.strategy = "basic"
auth.user = "cloud_username"
auth.password = "cloud_token"
compression = "none"
    [sinks.qryn_logs.labels]
    forwarder = "vector"
    event = "{{ facility }}"
    type = "fargate"
    [sinks.qryn_logs.encoding]
    codec = "json"
```

🎉*That's it!* No need to worry about any extra steps or configuration options - Vector will deliver *metrics, logs, and traces* to your qryn backend automatically.

---

### Data & Dashboard Usage

*Use our polyglot APIs to access your data using Grafana Loki, Prometheus and Tempo datasources without requiring any additional plugin or modification.*

Once your data is collected, you're ready to start building your queries and panels - or download and deploy the Grafana **Serverless Health Dashboard \***

![A screenshot of the serverless health dashboard for Fargate. ](https://grafana.com/media/blog/Fargate-monitoring/Fargate-monitoring-3.png align="left")

### Service Correlation

Users can drill down into specific Fargate clusters that may be encountering problems and correlate that data with logs and metrics generated by other serverless services such as Lambda functions through matching labels and tags.

Users may check, for instance, which cluster pods are using the most CPU and whether the associated Lambda function is affected to quickly identify and isolate problems and root causes with a seamless, associated view of their surroundings.

![](https://grafana.com/media/blog/Fargate-monitoring/Fargate-monitoring-2.png align="left")

> \* Dashboard images linked from the Grafana.com Blog

### 💡 Need More Metrics?

Grafana Agent, Vector and Telegraf can scrape Prometheus metric endpoints and write resulting timeseries directly to **qryn** through the Prometheus `remote_write` API

### 💡 Need More Logs?

Extend the Agents configuration to include logs or simply instrument your pods with **Promtail** to export any interesting log to **qryn** or **qryn.cloud**

*Ready to get polyglot? Activate your setup today on* [*qryn.cloud*](https://qryn.cloud)

### ⚡Powered by [Gigapipe](https://gigapipe.com)

[![](https://cdn.hashnode.com/res/hashnode/image/upload/v1676413342775/491ef8fb-6764-4786-8d87-02d3a0e60642.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")](https://qryn.cloud)
