Skip to content

Commit f9a0127

Browse files
committed
updated the usage section to explain the base modules and how can it be customized to create managed prometheus and grafana
1 parent a00d82c commit f9a0127

File tree

1 file changed

+71
-11
lines changed

1 file changed

+71
-11
lines changed

README.md

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,86 @@ To view examples for how you can leverage AWS Observability accelerator, please
4545

4646
The below demonstrates how you can leverage AWS Observability Accelerator to enable monitoring to an existing EKS cluster, Managed Service for Prometheus and Amazon Managed Grafana workspaces. Configure the environment variables like below
4747

48-
Change the directory
48+
### Base Module Snippet
49+
50+
This base module allows you to customize whether you would like to use the existing Managed Service for Prometheus and Amazon Managed Grafana workspaces or you can update to create new workspaces.
51+
52+
`
53+
# deploys the base module
54+
module "eks_observability_accelerator" {
55+
# source = "aws-observability/terrarom-aws-observability-accelerator"
56+
source = "../../"
57+
58+
aws_region = var.aws_region
59+
eks_cluster_id = var.eks_cluster_id
60+
61+
# deploys AWS Distro for OpenTelemetry operator into the cluster
62+
enable_amazon_eks_adot = true
63+
64+
# reusing existing certificate manager? defaults to true
65+
enable_cert_manager = true
66+
67+
# creates a new AMP workspace, defaults to true
68+
enable_managed_prometheus = false
69+
70+
# reusing existing AMP -- needs data source for alerting rules
71+
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
72+
managed_prometheus_workspace_region = null # defaults to the current region, useful for cross region scenarios (same account)
73+
74+
# sets up the AMP alert manager at the workspace level
75+
enable_alertmanager = true
76+
77+
# reusing existing Amazon Managed Grafana workspace
78+
enable_managed_grafana = false
79+
managed_grafana_workspace_id = var.managed_grafana_workspace_id
80+
grafana_api_key = var.grafana_api_key
81+
82+
tags = local.tags
83+
}
84+
`
85+
86+
The values being passed either via environment variables or files would be used here to refer to the existing EKS cluster and its region.
87+
88+
`
89+
aws_region = var.aws_region
90+
eks_cluster_id = var.eks_cluster_id
91+
`
92+
93+
By default, it tries to use the existing Managed Service for Prometheus and Amazon Managed Grafana workspaces however, you can customize them by toggling the below variables.
94+
95+
`
96+
# creates a new AMP workspace, defaults to true
97+
enable_managed_prometheus = false
98+
99+
...
100+
101+
# reusing existing Amazon Managed Grafana workspace
102+
enable_managed_grafana = false
103+
104+
`
105+
106+
You need to turn on `enable_managed_prometheus` and `enable_managed_grafana` variables to create a new managed workspaces for both Prometheus and Grafana.
107+
108+
### Example on how to enable monitoring using existing EKS Cluster, Managed Service for Prometheus and Amazon Managed Grafana workspaces by setting up the necessary environment variables.
109+
110+
1. Make sure to complete the prerequisites and clone the repository.
111+
112+
2. Change the directory
49113

50114
`cd terraform-aws-observability-accelerator/examples/existing-cluster-with-base-and-infra/`
51115

52-
Initialize terraform
116+
3. Initialize terraform
53117

54118
`terraform init`
55119

56120
`
57-
export TF_VAR_eks_cluster_id=xxx
58-
export TF_VAR_managed_prometheus_workspace_id=ws-xxx #existing workspace id otherwise new workspace will be created
59-
export TF_VAR_managed_grafana_workspace_id=g-xxx #existing workspace id otherwise new workspace will be created
60-
export TF_VAR_grafana_api_key="xxx" #refer getting started section which shows the steps to create Grafana api key
121+
export TF_VAR_eks_cluster_id=xxx # existing EKS clusterid
122+
export TF_VAR_managed_prometheus_workspace_id=ws-xxx #existing workspace id otherwise new workspace will be created
123+
export TF_VAR_managed_grafana_workspace_id=g-xxx #existing workspace id otherwise new workspace will be created
124+
export TF_VAR_grafana_api_key="xxx" #refer getting started section which shows the steps to create Grafana api key
61125
`
62126

63-
Deploy
127+
4. Deploy using environment variables
64128

65129
`terraform apply`
66130

@@ -75,10 +139,6 @@ The code above will provision the following:
75139
* Creates an Observability folder within the Amazon Managed Grafana workspace(specified in the terraform variable file) and deploys 25 grafana dashboards which visually displays the metrics collected by Amazon Managed Service for Prometheus
76140

77141

78-
## Submodules
79-
80-
The root module calls into several submodules which provides support for deploying and integrating a number of external AWS services that can be used in concert with Amazon EKS. This includes Amazon Managed Prometheus, AWS OpenTelemetry Operator etc..,
81-
82142
## Motivation
83143

84144
Kubernetes is a powerful and extensible container orchestration technology that allows you to deploy and manage containerized applications at scale. The extensible nature of Kubernetes also allows you to use a wide range of popular open-source tools, commonly referred to as add-ons, in Kubernetes clusters. With such a large number of tooling and design choices available however, building a tailored EKS cluster that meets your application’s specific needs can take a significant amount of time. It involves integrating a wide range of open-source tools and AWS services and requires deep expertise in AWS and Kubernetes.

0 commit comments

Comments
 (0)