|
1 | 1 | # AWS Observability Accelerator for Terraform
|
2 | 2 |
|
3 |
| -Welcome to AWS Observability Accelerator for Terraform! |
| 3 | +Welcome to the AWS Observability Accelerator for Terraform! |
4 | 4 |
|
5 |
| -The AWS Observability accelerator for Terraform is a set of modules to help you configure Observability for your Amazon EKS clusters with AWS Observability services. |
| 5 | +The AWS Observability accelerator for Terraform is a set of modules to help you |
| 6 | +configure Observability for your Amazon EKS clusters with AWS Observability services. |
| 7 | +This project proposes a core module to bootstrap your cluster with the AWS Distro for |
| 8 | +OpenTelemetry (ADOT) Operator for EKS, Amazon Managed Service for Prometheus (AMP), |
| 9 | +Amazon Managed Grafana (AMG). Additionally we have a set of workloads modules to |
| 10 | +leverage curated ADOT collector configurations, Grafana dashboards, |
| 11 | +Prometheus recording rules and alerts. |
6 | 12 |
|
7 |
| -This project proposes a core module to bootstrap your cluster with the AWS Distro for OpenTelemetry (ADOT) Operator for EKS, Amazon Managed Service for Prometheus (AMP), Amazon Managed Grafana (AMG). Additionally we have a set of workloads modules to leverage curated ADOT collector configurations, Grafana dashboards, Prometheus rules and alerts. |
| 13 | +You can check our [examples](./examples) for different end-to-end integrations scenarios. |
8 | 14 |
|
9 |
| -You can check our examples (https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/examples) for different end-to-end integrations scenarios. |
| 15 | +We will be leveraging [EKS Blueprints](https://github.com/aws-ia/terraform-aws-eks-blueprints) |
| 16 | +repository to deploy the solution. |
10 | 17 |
|
11 |
| -We will be leveraging EKS Blueprints (https://github.com/aws-ia/terraform-aws-eks-blueprints) repository to deploy the solution. |
| 18 | +## Example Usage |
12 | 19 |
|
13 |
| -## Getting Started |
| 20 | +The sections below demonstrate how you can leverage AWS Observability Accelerator |
| 21 | +to enable monitoring to an existing EKS cluster. |
14 | 22 |
|
15 |
| -Prerequisites for each of the examples are covered with in the examples directory. |
| 23 | +### Base Module |
16 | 24 |
|
17 |
| -## Deployment Steps |
18 |
| -Clone the repository that contains the EKS blueprints: |
| 25 | +The base module allows you to configure the AWS Observability services for your cluster and |
| 26 | +the AWS Distro for OpenTelemetry (ADOT) Operator as the signals collection mechanism. |
19 | 27 |
|
20 |
| -`git clone https://github.com/aws-observability/terraform-aws-eks-blueprints.git` |
| 28 | +This is the minimum configuration to have a new Managed Grafana Workspace, Amazon Managed |
| 29 | +Service for Prometheus Workspace, ADOT Operator deployed for you and ready to receive your |
| 30 | +data. |
21 | 31 |
|
22 |
| - |
23 |
| -# Generate Grafana API Key |
24 |
| - |
25 |
| -* Give admin access to the SSO user you set up when creating the Amazon Managed Grafana Workspace: |
26 |
| -* In the AWS Console, navigate to Amazon Grafana. In the left navigation bar, click **All workspaces**, then click on the workspace name you are using for this example. |
27 |
| -* Under **Authentication** within **AWS Single Sign-On (SSO)**, click **Configure users and user groups** |
28 |
| -* Check the box next to the SSO user you created and click **Make admin** |
29 |
| -* From the workspace in the AWS console, click on the `Grafana workspace` URL to open the workspace |
30 |
| -* If you don't see the gear icon in the left navigation bar, log out and log back in. |
31 |
| -* Click on the gear icon, then click on the **API keys** tab. |
32 |
| -* Click **Add API key**, fill in the *Key name* field and select *Admin* as the Role. |
33 |
| -* Copy your API key |
34 |
| - |
35 |
| - |
36 |
| -## Documentation |
37 |
| - |
38 |
| -For complete project documentation, please visit our documentation (https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/docs) site. |
39 |
| - |
40 |
| -## Examples |
41 |
| - |
42 |
| -To view examples for how you can leverage AWS Observability accelerator, please see the examples (https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/examples) directory. |
43 |
| - |
44 |
| -## Usage |
45 |
| - |
46 |
| -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 |
47 |
| - |
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 |
| 32 | +```hcl |
54 | 33 | 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 |
| 34 | + source = "aws-observability/terrarom-aws-observability-accelerator" |
| 35 | + aws_region = "eu-west-1" |
| 36 | + eks_cluster_id = "my-eks-cluster" |
| 37 | +} |
| 38 | +``` |
60 | 39 |
|
61 |
| - # deploys AWS Distro for OpenTelemetry operator into the cluster |
62 |
| - enable_amazon_eks_adot = true |
| 40 | +You can optionally reuse existing Workspaces: |
63 | 41 |
|
64 |
| - # reusing existing certificate manager? defaults to true |
65 |
| - enable_cert_manager = true |
| 42 | +```hcl |
| 43 | +module "eks_observability_accelerator" { |
| 44 | + source = "aws-observability/terrarom-aws-observability-accelerator" |
| 45 | + aws_region = "eu-west-1" |
| 46 | + eks_cluster_id = "my-eks-cluster" |
66 | 47 |
|
67 |
| - # creates a new AMP workspace, defaults to true |
| 48 | + # prevents creation of a new AMP workspace |
68 | 49 | enable_managed_prometheus = false
|
69 | 50 |
|
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) |
| 51 | + # reusing existing AMP |
| 52 | + managed_prometheus_workspace_id = "ws-abcd123..." |
73 | 53 |
|
74 |
| - # sets up the AMP alert manager at the workspace level |
75 |
| - enable_alertmanager = true |
76 |
| - |
77 |
| - # reusing existing Amazon Managed Grafana workspace |
| 54 | + # prevents creation of a new AMG workspace |
78 | 55 | enable_managed_grafana = false
|
79 |
| - managed_grafana_workspace_id = var.managed_grafana_workspace_id |
80 |
| - grafana_api_key = var.grafana_api_key |
81 | 56 |
|
82 |
| - tags = local.tags |
| 57 | + managed_grafana_workspace_id = 'g-abcdef123' |
| 58 | + grafana_api_key = var.grafana_api_key |
83 | 59 | }
|
84 |
| -` |
| 60 | +``` |
85 | 61 |
|
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. |
| 62 | +View all the configuration options in the module documentation below. |
87 | 63 |
|
88 |
| -` |
89 |
| - aws_region = var.aws_region |
90 |
| - eks_cluster_id = var.eks_cluster_id |
91 |
| -` |
| 64 | +### Workload modules |
92 | 65 |
|
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. |
| 66 | +We provide also workloads modules which essentially provide curated |
| 67 | +metrics collection, alerting rule and Grafana dashboards. |
94 | 68 |
|
95 |
| -` |
96 |
| -# creates a new AMP workspace, defaults to true |
97 |
| - enable_managed_prometheus = false |
98 | 69 |
|
99 |
| -... |
| 70 | +#### Infrastructure monitoring |
100 | 71 |
|
101 |
| -# reusing existing Amazon Managed Grafana workspace |
102 |
| - enable_managed_grafana = false |
103 | 72 |
|
104 |
| -` |
105 | 73 |
|
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. |
| 74 | +```hcl |
| 75 | +module "workloads_infra" { |
| 76 | + source = "aws-observability/terrarom-aws-observability-accelerator/workloads/infra" |
107 | 77 |
|
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. |
| 78 | + eks_cluster_id = module.eks_observability_accelerator.eks_cluster_id |
109 | 79 |
|
110 |
| -1. Make sure to complete the prerequisites and clone the repository. |
| 80 | + dashboards_folder_id = module.eks_observability_accelerator.grafana_dashboards_folder_id |
| 81 | + managed_prometheus_workspace_id = module.eks_observability_accelerator.managed_prometheus_workspace_id |
111 | 82 |
|
112 |
| -2. Change the directory |
113 |
| - |
114 |
| -`cd terraform-aws-observability-accelerator/examples/existing-cluster-with-base-and-infra/` |
115 |
| - |
116 |
| -3. Initialize terraform |
117 |
| - |
118 |
| -`terraform init` |
119 |
| - |
120 |
| -` |
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 |
125 |
| -` |
126 |
| - |
127 |
| -4. Deploy using environment variables |
| 83 | + managed_prometheus_workspace_endpoint = module.eks_observability_accelerator.managed_prometheus_workspace_endpoint |
| 84 | + managed_prometheus_workspace_region = module.eks_observability_accelerator.managed_prometheus_workspace_region |
| 85 | +} |
| 86 | +``` |
128 | 87 |
|
129 |
| -`terraform apply` |
| 88 | +Grafana dashboard |
130 | 89 |
|
131 | 90 |
|
132 |
| -The code above will provision the following: |
133 | 91 |
|
134 |
| -* Enables the AWS EKS Add-on for ADOT operator (https://docs.aws.amazon.com/eks/latest/userguide/opentelemetry.html) to the existing Amazon EKS Cluster (specified in the environment variable) and deploys the ADOT collector with appropriate scrape configuration to ingest metrics to Amazon Managed Service for Prometheus |
135 |
| -* Deploys kube-state-metrics (https://github.com/kubernetes/kube-state-metrics) to generate Prometheus format metrics based on the current state of the Kubernetes native resource |
136 |
| -* Deploys Node_exporter (https://github.com/prometheus/node_exporter) to collect infrastructure metrics like CPU, Memory and Disk size etc |
137 |
| -* Deploys rule files in the Amazon Managed Service for Prometheus Workspace(specified in the terraform variable file) containing rule groups with over 200 rules to gather metrics about Kubernetes native objects |
138 |
| -* Configures the Amazon Managed Service for Prometheus workspace as a datasource in the Amazon Managed Grafana workspace |
139 |
| -* 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 |
| 92 | +To quickstart with a complete workflow, visit the [existing cluster with base and module example](./examples/existing-cluster-with-base-and-infra/) |
140 | 93 |
|
141 | 94 |
|
142 | 95 | ## Motivation
|
@@ -227,7 +180,7 @@ If you are interested in contributing to EKS Blueprints, see the Contribution (h
|
227 | 180 | | <a name="output_managed_prometheus_workspace_region"></a> [managed\_prometheus\_workspace\_region](#output\_managed\_prometheus\_workspace\_region) | n/a |
|
228 | 181 | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
229 | 182 |
|
230 |
| -## Security |
| 183 | +## Contributing |
231 | 184 |
|
232 | 185 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
|
233 | 186 |
|
|
0 commit comments