In this Blog, we are going to create the AWS-managed Prometheus and grafana using Terraform and We will deploy the Cloudwatch agent with fl...
In this Blog, we are going to create the AWS-managed Prometheus and grafana using Terraform and We will deploy the Cloudwatch agent with fluent using helm chart and collect the (Container insights) application logs, and data-plane logs.
What is Prometheus?
Prometheus is an open-source tool that monitors and alerts for systems and is used to collect and store metrics from applications and infrastructure. It's used to monitor cloud-native architectures, such as Kubernetes.
Amazon Managed Service for Prometheus is a fully managed Prometheus-compatible monitoring service that makes it easy to monitor containerized applications securely and at scale.
Benefits and features:
Prometheus-compatible APIs give you access to remote write metrics from existing Prometheus servers and query metrics using PromQL.
AMP integrates with AWS Identity and Access Management (IAM) for authentication and fine-grained permissions for users and groups. VPC PrivateLink provides easy and secure access to services hosted on AWS, keeping your network traffic within the AWS network.
AMP automatically scales as your ingestion and query needs grow, handling millions of unique time series metrics using multi-AZ deployments.
What is grafana
Grafana is an open-source analytics and monitoring tool that helps users visualize, query, alert, and understand their data.
Amazon Managed Grafana is a fully managed Grafana service that is scalable, secure, and highly available. Using Amazon Managed Grafana, you can analyze, monitor, and alarm on metrics, logs, and traces across multiple data sources.
Before creating the Prometheus and grafana we need an EKS cluster. Check out our blog on the creation of the EKS cluster from scratch.
Now we need to create the resources using Terraform, you can find the Terraform code on my repo https://github.com/maneshmohan124/Techiev-observability
In the main.tf file, we are adding the modules for creating the AMP and grafana workspace.
In the grafana workspace, we can add AWS data sources for now we are adding cloudwatch and Prometheus. Later blogs we can add x-ray and elastic search.
In the variables.tf we are declaring the env, region, oidc ARN, URL.
What is helm?
The Helm chart of cloudwatchagent with fluent can be found inside our repo
Repo URL: https://github.com/maneshmohan124/Techiev-observability
In the Helm chart values.yaml we need to type our Cluster name and region.
The Helm chart will create the Namespace, role, role binding, config map, daemonset for cloudwatchagent, and fluent.
command: helm upgrade amazon-cloudwatch ./cloudwatch-fluent-bit --install -f ./cloudwatch-fluent-bit/values.yaml
Before Checking the Cloudwatch log group, we need to add CloudWatchAgentServerPolicy to our worker node Role.
After deploying the Cloudwatch and Fluent you can find the log groups inside the cloudwatch.
We have successfully created the AMP and grafana and deployed the Cloudwatch agent with fluent using helm chart and collected the (Container insights) application logs, and data-plane logs,
we can collect the Container insights with Cloudatchagent using Eks Add-ons. Later we will see as a blog for another option.