Skip to content

Commit 6d5aaa8

Browse files
authored
Merge pull request #10 from aws-observability/existing-cluster-example-doc
Add example doc
2 parents df314a4 + 80d7acf commit 6d5aaa8

File tree

1 file changed

+77
-7
lines changed
  • examples/existing-cluster-with-base-and-infra

1 file changed

+77
-7
lines changed

examples/existing-cluster-with-base-and-infra/README.md

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,96 @@ module with Infrastructure monitoring enabled.
77
The current example deploys the [AWS Distro for OpenTelemetry Operator](https://docs.aws.amazon.com/eks/latest/userguide/opentelemetry.html) for Amazon EKS with its requirements and make use of existing
88
Managed Service for Prometheus and Amazon Managed Grafana workspaces.
99

10-
It also uses the `infrastructure monitoring`, one of our [workloads modules](../../modules/workloads/)
10+
It is based on the `infrastructure monitoring`, one of our [workloads modules](../../modules/workloads/)
1111
to provide an existing EKS cluster with an OpenTelemetry collector,
1212
curated Grafana dashboards, Prometheus alerting and recording rules with multiple
13-
configuration options.
14-
15-
#### ⚠️ Grafana API Key
13+
configuration options on the cluster infrastructure.
1614

1715

1816
## Prerequisites
1917

20-
1. EKS cluster
21-
2. Prometheus
22-
3. Grafana
18+
Ensure that you have the following tools installed locally:
19+
20+
1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
21+
1. [kubectl](https://kubernetes.io/docs/tasks/tools/)
22+
1. [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
23+
24+
25+
## Setup
26+
27+
This example uses a local terraform state. If you need states to be saved remotely,
28+
on Amazon S3 for example, visit the [terraform remote states](https://www.terraform.io/language/state/remote) documentation
29+
30+
1. Initialize terraform
31+
32+
```console
33+
terraform init
34+
```
35+
36+
1. EKS Cluster
37+
38+
To run this example, you need to provide your EKS cluster ID.
39+
If you don't have a cluster ready, visit [this example](../new-empty-eks-cluster) first to create a new one.
40+
41+
Add `eks_cluster_id=xxx` to your `terraform.tfvars` or use an
42+
environment variable `export TF_VAR_eks_cluster_id=xxx`.
43+
44+
1. Amazon Managed Service for Prometheus workspace
45+
46+
If you have an existing workspace, add `managed_prometheus_workspace_id=ws-xxx`
47+
or use an environment variable `export TF_VAR_managed_prometheus_workspace_id=ws-xxx`.
48+
49+
If you don't specify anything a new workspace will be created for you.
50+
51+
52+
1. Amazon Managed Grafana workspace
53+
54+
55+
If you have an existing workspace, add `managed_grafana_workspace_id=g-xxx`
56+
or use an environment variable `export TF_VAR_managed_grafana_workspace_id=g-xxx`.
57+
58+
If you don't specify anything a new workspace will be created for you.
59+
60+
61+
1. Grafana API Key
62+
<!-- TODO: Remove section when CP Grafana API keys is supported by Terraform -->
63+
64+
- Give admin access to the SSO user you set up when creating the Amazon Managed Grafana Workspace:
65+
- 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.
66+
- Under **Authentication** within **AWS Single Sign-On (SSO)**, click **Configure users and user groups**
67+
- Check the box next to the SSO user you created and click **Make admin**
68+
- From the workspace in the AWS console, click on the `Grafana workspace URL` to open the workspace
69+
- If you don't see the gear icon in the left navigation bar, log out and log back in.
70+
- Click on the gear icon, then click on the **API keys** tab.
71+
- Click **Add API key**, fill in the _Key name_ field and select _Admin_ as the Role.
72+
- Copy your API key into `terraform.tfvars` under the `grafana_api_key` variable (`grafana_api_key="xxx"`) or set as an environment variable on your CLI (`export TF_VAR_grafana_api_key="xxx"`)
73+
2374

2475
## Deploy
2576

77+
```sh
78+
terraform apply -var terraform.tfvars
79+
```
80+
81+
or if you had setup environment variables
82+
2683
```sh
2784
terraform apply
2885
```
2986

87+
## Advanced configuration
88+
89+
1. Cross-region Managed Prometheus workspace
90+
91+
If your existing Managed Prometheus workspace is in another AWS Region,
92+
add this `managed_prometheus_region=xxx` and `managed_prometheus_workspace_id=ws-xxx`.
93+
94+
1. Cross-region Managed Grafana workspace
95+
96+
If your existing Managed Prometheus workspace is in another AWS Region,
97+
add this `managed_prometheus_region=xxx` and `managed_prometheus_workspace_id=ws-xxx`.
98+
99+
30100
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
31101
## Requirements
32102

0 commit comments

Comments
 (0)