Revolutionizing Monitoring: Exploring the Power of Amazon Managed Service for Prometheus
Published: 2024-03-06 12:38:10

In the dynamic landscape of cloud computing, efficient monitoring is paramount for ensuring the reliability and performance of applications. Amazon Web Services (AWS) has recently introduced a game-changer in the realm of observability – the Amazon Managed Service for Prometheus. This blog dives into the capabilities, benefits, and transformative impact of this managed service, showcasing how it empowers businesses to scale their monitoring infrastructure seamlessly.

## Understanding the Need for Advanced Monitoring
In this section, we explore the evolving needs of modern applications and the challenges associated with traditional monitoring solutions. From the complexities of managing scale to the demand for real-time insights, we set the stage for the emergence of Amazon Managed Service for Prometheus.

## Unveiling Amazon Managed Service for Prometheus
Delve into the features and architecture of Amazon Managed Service for Prometheus. Highlight the simplicity of setup, seamless integration with existing AWS services, and the scalability that it offers. Emphasize how this managed service lifts the burden of infrastructure management, allowing teams to focus on deriving actionable insights from their monitoring data.

## Key Benefits and Use Cases
Examine the tangible benefits of adopting Amazon Managed Service for Prometheus. From cost savings to improved reliability, discuss how this service enhances observability for applications running on AWS. Provide real-world use cases that showcase the versatility of Prometheus in different scenarios.

## Seamless Integration with AWS Ecosystem
Explore the tight integration of Amazon Managed Service for Prometheus with other AWS services, such as Amazon CloudWatch and AWS Identity and Access Management (IAM). Discuss how this interoperability enriches the monitoring experience and contributes to a holistic approach to application observability.

## Getting Started - A Step-by-Step Guide
Offer readers a practical guide on getting started with Amazon Managed Service for Prometheus. Cover the essential steps, share best practices, and highlight any considerations for a smooth onboarding process.

**Step 1: Accessing the AWS Management Console**
Begin by logging into the AWS Management Console. Navigate to the Amazon Managed Service for Prometheus section and initiate the setup process.

**Step 2: Creating a Prometheus Workspace**
Follow the prompts to create a new Prometheus workspace. Define the required parameters such as the workspace name, desired region, and any specific configurations based on your monitoring needs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4fp45dhh115vgkgz7sk.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6g1zjxqjdrv0kdfoll5h.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8padm7b62xzf4ey4i4j.png)

```
arn:aws:aps:us-east-1:726459634338:workspace/ws-420cc8c0-93ff-4bfd-9dfb-48e0e9a02d5a
```

**Endpoint - remote write URL**
https://aps-workspaces.us-east-1.amazonaws.com/workspaces/ws-420cc8c0-93ff-4bfd-9dfb-48e0e9a02d5a/api/v1/remote_write

**Endpoint - query URL**
https://aps-workspaces.us-east-1.amazonaws.com/workspaces/ws-420cc8c0-93ff-4bfd-9dfb-48e0e9a02d5a/api/v1/query

**Step 3: Set up IAM roles for service accounts**
For the method of onboarding that we are documenting, you need to use IAM roles for service accounts in the Amazon EKS cluster where the Prometheus server is running. These roles are also called service roles.

With service roles, you can associate an IAM role with a Kubernetes service account. This service account can then provide AWS permissions to the containers in any pod that uses that service account. For more information, see IAM roles for service accounts. 

If you have not already set up these roles, follow this instructions to set up the roles: Set up service roles for the ingestion of metrics from Amazon EKS clusters. 

Please make sure you have created an IAM role called amp-iamproxy-ingest-role before continuing.

**Step 4: Upgrade your existing Prometheus server using Helm (for Prometheus version 2.26.0 or later)**

The instructions in this section includes setting up remote write and sigv4 to authenticate and authorize the Prometheus server to remote write to your AMP workspace.

To set up remote write from a Prometheus server using Helm chart:
Create a new remote write section in your Helm configuration file:
```
serviceAccounts:
    server:
        name: "amp-iamproxy-ingest-service-account"
        annotations:
            eks.amazonaws.com/role-arn: "arn:aws:iam::726459634338:role/amp-iamproxy-ingest-role"
server:
    remoteWrite:
        - url: https://aps-workspaces.us-east-1.amazonaws.com/workspaces/ws-420cc8c0-93ff-4bfd-9dfb-48e0e9a02d5a/api/v1/remote_write
          sigv4:
            region: us-east-1
          queue_config:
            max_samples_per_send: 1000
            max_shards: 200
            capacity: 2500
```
Update your existing Prometheus Server configuration using Helm:

First, find your Helm chart name by entering the following command:
```
helm ls --all-namespaces
```
In the output from this command, look for a chart with a name that includes "prometheus".

Then enter the following command:
```
helm upgrade prometheus-chart-name prometheus-community/prometheus -n prometheus_namespace -f my_prometheus_values_yaml --version current_helm_chart_version
```
Replace these placeholders with the following:

- Replace prometheus-chart-name with the name of the helm chart you found with the previous command.
- Replace prometheus_namespace with the name of the Kubernetes namespace where your Prometheus Server is installed.
- Replace my_prometheus_values_yaml with the path to your Helm configuration file.
- Replace current_helm_chart_version with the current version of the Prometheus Server Helm chart you found with the previous command.


## Grafana
**Step-1:** Follow the following procedure to setting up managed grafana.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hvg1hkb38x86848dxqu.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2kfvmz2678nqxthr4rv.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zm1t5mfx8jzkujcuk2jq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rfi3fehw1vcieb2gdhzi.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37gchetgnl4yh0b0uf8n.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vivkcspkhk823uqgdkrp.png)


**Step 2:** Configuring Data Retention and Storage Options
Fine-tune your monitoring environment by configuring data retention policies and storage options. Tailor these settings to align with your application's requirements and expected data volumes.

**Step 3:** Integrating with AWS Resources
Connect Amazon Managed Service for Prometheus with your existing AWS resources. This could include linking it to Amazon Elastic Kubernetes Service (EKS) clusters, Amazon EC2 instances, or any other AWS services generating monitoring data.

**Step 4:** Setting Up Alerts and Notifications
Enhance your observability by configuring alerts and notifications. Define thresholds for metrics that matter most to your applications and establish alerting mechanisms to keep your team informed of any deviations from expected behavior.

**Step 5:** Exploring Querying Capabilities
Dive into the querying capabilities of Amazon Managed Service for Prometheus. Learn how to write PromQL queries to extract valuable insights from your monitoring data. Leverage this functionality to troubleshoot issues, analyze trends, and optimize performance.

**Step 6:** Integrating with AWS CloudWatch
Explore the seamless integration between Amazon Managed Service for Prometheus and AWS CloudWatch. Understand how these services work together to provide a comprehensive monitoring solution for your AWS environment.

**Step 7:** Scaling and Optimization
As your application grows, ensure that your monitoring solution scales accordingly. Learn best practices for scaling Amazon Managed Service for Prometheus and optimizing its performance to meet the evolving demands of your applications.


Wrap up the blog by summarizing the key takeaways and emphasizing the transformative potential of Amazon Managed Service for Prometheus. Encourage readers to explore this powerful monitoring solution to elevate their observability practices and stay ahead in the ever-evolving landscape of cloud-native applications.

By shedding light on the capabilities of Amazon Managed Service for Prometheus, this blog aims to guide organizations toward a more efficient and scalable approach to monitoring, ultimately enhancing their ability to deliver reliable and performant applications on AWS.