Skip to content

Commit 71b6f35

Browse files
bonclay7charliekeeeganchakeegambeacom
authored
Amazon Managed Grafana setup (#133)
* Managed Grafana Workspace with Identity Centre Users (#83) * update kuberenetes and instance type * initial setup of managed grafana workspace and identity centre identities * cleanup * run precommit * output grafana workspace ID * add identity store id variable * remove API key * update outputs naming convention as per terraform guidelines * update docs and add versions * update variables type * update naming conventions * add managed policy arn for querying promethues * update readme * update workshop references to this * add role arn type * cleanup and simplification * remove workshop --------- Co-authored-by: charlie keegan <[email protected]> Co-authored-by: Rodrigue Koffi <[email protected]> * Rename example * Update grafana example and base module references * Update example's reference * Cleanup and docs ref * Add docs * Update docs * TODO: add link after merge * Update managed-grafana.md --------- Co-authored-by: Charlie Keegan <[email protected]> Co-authored-by: charlie keegan <[email protected]> Co-authored-by: Mark Beacom <[email protected]>
1 parent 0abea3c commit 71b6f35

File tree

21 files changed

+209
-52
lines changed

21 files changed

+209
-52
lines changed

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ View all the configuration options in the module documentation below.
9191
### Workload modules
9292

9393
[Workloads modules](./modules) are provided, which essentially provide curated
94-
metrics collection, alerting rule and Grafana dashboards.
94+
metrics collection, alerting rules and Grafana dashboards.
9595

9696
#### Infrastructure monitoring
9797

@@ -151,9 +151,7 @@ If you are interested in contributing, see the [Contribution guide](https://gith
151151

152152
## Modules
153153

154-
| Name | Source | Version |
155-
|------|--------|---------|
156-
| <a name="module_managed_grafana"></a> [managed\_grafana](#module\_managed\_grafana) | terraform-aws-modules/managed-service-grafana/aws | ~> 1.3 |
154+
No modules.
157155

158156
## Resources
159157

@@ -172,7 +170,6 @@ If you are interested in contributing, see the [Contribution guide](https://gith
172170
|------|-------------|------|---------|:--------:|
173171
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS Region | `string` | n/a | yes |
174172
| <a name="input_enable_alertmanager"></a> [enable\_alertmanager](#input\_enable\_alertmanager) | Creates Amazon Managed Service for Prometheus AlertManager for all workloads | `bool` | `false` | no |
175-
| <a name="input_enable_managed_grafana"></a> [enable\_managed\_grafana](#input\_enable\_managed\_grafana) | Creates a new Amazon Managed Grafana Workspace | `bool` | `true` | no |
176173
| <a name="input_enable_managed_prometheus"></a> [enable\_managed\_prometheus](#input\_enable\_managed\_prometheus) | Creates a new Amazon Managed Service for Prometheus Workspace | `bool` | `true` | no |
177174
| <a name="input_grafana_api_key"></a> [grafana\_api\_key](#input\_grafana\_api\_key) | Grafana API key for the Amazon Managed Grafana workspace | `string` | n/a | yes |
178175
| <a name="input_managed_grafana_workspace_id"></a> [managed\_grafana\_workspace\_id](#input\_managed\_grafana\_workspace\_id) | Amazon Managed Grafana Workspace ID | `string` | `""` | no |

docs/eks/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Amazon EKS cluster metrics
22

33
This example demonstrates how to monitor your Amazon Elastic Kubernetes Service
4-
(Amazon EKS) cluster with the Observability Accelerator's
4+
(Amazon EKS) cluster with the Observability Accelerator's
55
[EKS monitoring module](https://github.com/aws-observability/terraform-aws-observability-accelerator/tree/main/modules/eks-monitoring).
66

77
Monitoring Amazon Elastic Kubernetes Service (Amazon EKS) for metrics has two categories:
@@ -72,9 +72,9 @@ aws amp create-workspace --alias observability-accelerator --query '.workspaceId
7272

7373
#### 5. Amazon Managed Grafana workspace
7474

75-
To run this example you need an Amazon Managed Grafana workspace. If you have an existing workspace, create an environment variable as described below.
76-
To create a new workspace, visit our Amazon Managed Grafana [documentation](https://docs.aws.amazon.com/grafana/latest/userguide/getting-started-with-AMG.html).
77-
Make sure to provide the workspace with Amazon Managed Service for Prometheus read permissions.
75+
To run this example you need an Amazon Managed Grafana workspace. If you have
76+
an existing workspace, create an environment variable as described below.
77+
To create a new workspace, visit our supporting example for Grafana.
7878

7979
!!! note
8080
For the URL `https://g-xyz.grafana-workspace.eu-central-1.amazonaws.com`, the workspace ID would be `g-xyz`

docs/helpers/managed-grafana.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Creating a new Amazon Managed Grafana Workspace
2+
3+
This example creates an Amazon Managed Grafana Workspace with
4+
Amazon CloudWatch, AWS X-Ray and Amazon Managed Service for Prometheus
5+
datasources.
6+
7+
The authentication method chosen for this example is with IAM Identity
8+
Center (former SSO). You can extend this example to add SAML.
9+
10+
## Prerequisites
11+
12+
!!! note
13+
Make sure to complete the [prerequisites section](https://aws-observability.github.io/terraform-aws-observability-accelerator/concepts/#prerequisites) before proceeding.
14+
15+
## Setup
16+
17+
### 1. Download sources and initialize Terraform
18+
19+
```
20+
git clone https://github.com/aws-observability/terraform-aws-observability-accelerator.git
21+
cd examples/managed-grafana-workspace
22+
terraform init
23+
```
24+
25+
### 2. AWS Region
26+
27+
Specify the AWS Region where the resources will be deployed:
28+
29+
```bash
30+
export TF_VAR_aws_region=xxx
31+
```
32+
33+
## Deploy
34+
35+
Simply run this command to deploy the example
36+
37+
```bash
38+
terraform apply
39+
```
40+
41+
## Authentication
42+
43+
After apply, Terraform will output the Worksapce's URL, but you need to:
44+
45+
- [Setup user(s)](https://docs.aws.amazon.com/singlesignon/latest/userguide/getting-started.html) in the IAM Identity Center (former SSO)
46+
- [Assign the user(s) to the workspace](https://docs.aws.amazon.com/grafana/latest/userguide/AMG-manage-users-and-groups-AMG.html) with proper permissions
47+
48+
<img width="1936" alt="Screenshot 2023-03-19 at 12 04 45" src="https://user-images.githubusercontent.com/10175027/226172947-f8588ed3-3751-47c1-a3ed-fb4c2d4d847e.png">
49+
50+
51+
## Cleanup
52+
53+
To clean up your environment, destroy the Terraform example by running
54+
55+
```sh
56+
terraform destroy
57+
```

docs/images/dark-o11y-accelerator-amp-xray.drawio

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/images/light-o11y-accelerator-amp-xray.drawio

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

examples/existing-cluster-java/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ Add your cluster name for `eks_cluster_id="..."` to the `terraform.tfvars` or us
5050

5151
4. Amazon Managed Grafana workspace
5252

53-
To run this example you need an Amazon Managed Grafana workspace. If you have an existing workspace, create an environment variable `export TF_VAR_managed_grafana_workspace_id=g-xxx`.
54-
To create a new one, visit our Amazon Managed Grafana [documentation](https://docs.aws.amazon.com/grafana/latest/userguide/getting-started-with-AMG.html).
55-
Make sure to provide the workspace with Amazon Managed Service for Prometheus read permissions.
53+
To run this example you need an Amazon Managed Grafana workspace. If you have
54+
an existing workspace, create an environment variable
55+
`export TF_VAR_managed_grafana_workspace_id=g-xxx`.
56+
57+
To create a new one, visit [this example](../managed-grafana-workspace).
5658

5759
> In the URL `https://g-xyz.grafana-workspace.eu-central-1.amazonaws.com`, the workspace ID would be `g-xyz`
5860

examples/existing-cluster-java/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ module "aws_observability_accelerator" {
4747
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
4848

4949
# reusing existing Amazon Managed Grafana workspace
50-
enable_managed_grafana = false
5150
managed_grafana_workspace_id = var.managed_grafana_workspace_id
5251
grafana_api_key = var.grafana_api_key
5352

examples/existing-cluster-nginx/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ Add your cluster name for `eks_cluster_id="..."` to the `terraform.tfvars` or us
4949

5050
4. Amazon Managed Grafana workspace
5151

52-
To run this example you need an Amazon Managed Grafana workspace. If you have an existing workspace, create an environment variable `export TF_VAR_managed_grafana_workspace_id=g-xxx`.
53-
To create a new one, visit our Amazon Managed Grafana [documentation](https://docs.aws.amazon.com/grafana/latest/userguide/getting-started-with-AMG.html).
54-
Make sure to provide the workspace with Amazon Managed Service for Prometheus read permissions.
52+
To run this example you need an Amazon Managed Grafana workspace. If you have
53+
an existing workspace, create an environment variable
54+
`export TF_VAR_managed_grafana_workspace_id=g-xxx`.
55+
56+
To create a new one, visit [this example](../managed-grafana-workspace).
5557

5658
> In the URL `https://g-xyz.grafana-workspace.eu-central-1.amazonaws.com`, the workspace ID would be `g-xyz`
5759

examples/existing-cluster-nginx/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ module "aws_observability_accelerator" {
4747
managed_prometheus_workspace_id = var.managed_prometheus_workspace_id
4848

4949
# reusing existing Amazon Managed Grafana workspace
50-
enable_managed_grafana = false
5150
managed_grafana_workspace_id = var.managed_grafana_workspace_id
5251
grafana_api_key = var.grafana_api_key
5352

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ Add your cluster name for `eks_cluster_id="..."` to the `terraform.tfvars` or us
4747

4848
4. Amazon Managed Grafana workspace
4949

50-
To run this example you need an Amazon Managed Grafana workspace. If you have an existing workspace, create an environment variable `export TF_VAR_managed_grafana_workspace_id=g-xxx`.
51-
To create a new one, visit our Amazon Managed Grafana [documentation](https://docs.aws.amazon.com/grafana/latest/userguide/getting-started-with-AMG.html).
52-
Make sure to provide the workspace with Amazon Managed Service for Prometheus read permissions.
50+
To run this example you need an Amazon Managed Grafana workspace. If you have
51+
an existing workspace, create an environment variable
52+
`export TF_VAR_managed_grafana_workspace_id=g-xxx`.
53+
54+
To create a new one, visit [this example](../managed-grafana-workspace).
5355

5456
> In the URL `https://g-xyz.grafana-workspace.eu-central-1.amazonaws.com`, the workspace ID would be `g-xyz`
5557

0 commit comments

Comments
 (0)