Grafana is a wealthy interactive open-source device by Grafana Labs for visualizing knowledge throughout one or many knowledge sources. It’s utilized in quite a lot of trendy monitoring stacks, permitting you to have a standard technical base and apply frequent monitoring practices throughout totally different programs. Amazon Managed Grafana is a totally managed, scalable, and safe Grafana-as-a-service resolution developed by AWS in collaboration with Grafana Labs.
Amazon Redshift is probably the most broadly used knowledge warehouse within the cloud. You possibly can view your Amazon Redshift cluster’s operational metrics on the Amazon Redshift console, use AWS CloudWatch, and question Amazon Redshift system tables instantly out of your cluster. The primary two choices present a set of predefined common metrics and visualizations. The final one means that you can use the flexibleness of SQL to get deep insights into the main points of the workload. Nonetheless, querying system tables requires information of system desk buildings. To handle that, we got here up with a consolidated Amazon Redshift Grafana dashboard that visualizes a set of curated operational metrics and works on high of the Amazon Redshift Grafana knowledge supply. You possibly can simply add it to an Amazon Managed Grafana workspace, in addition to to every other Grafana deployments the place the info supply is put in.
This submit guides you thru a step-by-step course of to create an Amazon Managed Grafana workspace and configure an Amazon Redshift cluster with a Grafana knowledge supply for it. Lastly, we present you the right way to arrange the Amazon Redshift Grafana dashboard to visualise the cluster metrics.
The next diagram illustrates the answer structure.
The answer contains the next parts:
- The Amazon Redshift cluster to get the metrics from.
- Amazon Managed Grafana, with the Amazon Redshift knowledge supply plugin added to it. Amazon Managed Grafana communicates with the Amazon Redshift cluster through the Amazon Redshift Information Service API.
- The Grafana internet UI, with the Amazon Redshift dashboard utilizing the Amazon Redshift cluster as the info supply. The online UI communicates with Amazon Managed Grafana through an HTTP API.
We stroll you thru the next steps through the configuration course of:
- Configure an Amazon Redshift cluster.
- Create a database consumer for Amazon Managed Grafana on the cluster.
- Configure a consumer in AWS Single Signal-On (AWS SSO) for Amazon Managed Grafana UI entry.
- Configure an Amazon Managed Grafana workspace and sign up to Grafana.
- Arrange Amazon Redshift as the info supply in Grafana.
- Import the Amazon Redshift dashboard provided with the info supply.
To comply with together with this walkthrough, it’s best to have the next conditions:
- An AWS account
- Familiarity with the essential ideas of the next providers:
- Amazon Redshift
- Amazon Managed Grafana
- AWS SSO
Configure an Amazon Redshift cluster
For those who don’t have an Amazon Redshift cluster, create a pattern cluster earlier than continuing with the next steps. For this submit, we assume that the cluster identifier known as
redshift-demo-cluster-1 and the admin consumer identify is
- On the Amazon Redshift console, select Clusters within the navigation pane.
- Select your cluster.
- Select the Properties tab.
To make the cluster discoverable by Amazon Managed Grafana, you have to add a particular tag to it.
- Select Add tags.
- For Key, enter GrafanaDataSource.
- For Worth, enter true.
- Select Save adjustments.
Create a database consumer for Amazon Managed Grafana
Grafana shall be instantly querying the cluster, and it requires a database consumer to connect with the cluster. On this step, we create the consumer
redshift_data_api_user and apply some safety greatest practices.
- On the cluster particulars web page, select Question knowledge and Question in question editor v2.
- Select the
redshift-demo-cluster-1cluster we created beforehand.
- For Database, enter the default
- Enter the consumer identify and password that you just used to create the cluster.
- Select Create connection.
- Within the question editor, enter the next statements and select Run:
CREATE USER redshift_data_api_user PASSWORD '<password>' CREATEUSER; ALTER USER redshift_data_api_user SET readonly TO TRUE; ALTER USER redshift_data_api_user SET query_group TO 'superuser';
The primary assertion creates a consumer with superuser privileges essential to entry system tables and views (be certain to make use of a singular password). The second prohibits the consumer from making modifications. The final assertion isolates the queries the consumer can run to the superuser queue, in order that they don’t intervene with the principle workload.
On this instance, we use service managed permissions in Amazon Managed Grafana and a workspace AWS Id and Entry Administration (IAM) position as an authentication supplier within the Amazon Redshift Grafana knowledge supply. We create the database consumer redshift_data_api_user utilizing the AmazonGrafanaRedshiftAccess coverage.
Configure a consumer in AWS SSO for Amazon Managed Grafana UI entry
Two authentication strategies can be found for accessing Amazon Managed Grafana: AWS SSO and SAML. On this instance, we use AWS SSO.
- On the AWS SSO console, select Customers within the navigation pane.
- Select Add consumer.
- Within the Add consumer part, present the required data.
On this submit, we choose Ship an e mail to the consumer with password setup directions. You want to have the ability to entry the e-mail deal with you enter since you use this e mail additional within the course of.
- Select Subsequent to proceed to the subsequent step.
- Select Add consumer.
An e mail is shipped to the e-mail deal with you specified.
- Select Settle for invitation within the e mail.
You’re redirected to sign up as a brand new consumer and set a password for the consumer.
- Enter a brand new password and select Set new password to complete the consumer creation.
Configure an Amazon Managed Grafana workspace and sign up to Grafana
Now you’re able to arrange an Amazon Managed Grafana workspace.
- On the Amazon Grafana console, select Create workspace.
- For Workspace identify, enter a reputation, for instance grafana-demo-workspace-1.
- Select Subsequent.
- For Authentication entry, choose AWS Single Signal-On.
- For Permission sort, choose Service managed.
- Selected Subsequent to proceed.
- For IAM permission entry settings, choose Present account.
- For Information sources, choose Amazon Redshift.
- Select Subsequent to complete the workspace creation.
You’re redirected to the workspace web page.
Subsequent, we have to allow AWS SSO as an authentication methodology.
- On the workspace web page, select Assign new consumer or group.
- Choose the beforehand created AWS SSO consumer beneath Customers and Choose customers and teams tables.
It is advisable to make the consumer an admin, as a result of we arrange the Amazon Redshift knowledge supply with it.
- Choose the consumer from the Customers record and select Make admin.
- Return to the workspace and select the Grafana workspace URL hyperlink to open the Grafana UI.
- Register with the consumer identify and password you created within the AWS SSO configuration step.
Arrange an Amazon Redshift knowledge supply in Grafana
To visualise the info in Grafana, we have to entry the info first. To take action, we should create an information supply pointing to the Amazon Redshift cluster.
- On the navigation bar, select the decrease AWS icon (there are two) after which select Redshift from the record.
- For Areas, select the Area of your cluster.
- Choose the cluster from the record and select Add 1 knowledge supply.
- On the Provisioned knowledge sources web page, select Go to settings.
- For Identify, enter a reputation on your knowledge supply.
- By default, Authentication Supplier must be set as Workspace IAM Function, Default Area must be the Area of your cluster, and Cluster Identifier must be the identify of the chosen cluster.
- For Database, enter dev.
- For Database Person, enter
- Select Save & Take a look at.
A hit message ought to seem.
Import the Amazon Redshift dashboard provided with the info supply
Because the final step, we import the default Amazon Redshift dashboard and guarantee that it really works.
- Within the knowledge supply we simply created, select Dashboards on the highest navigation bar and select Import to import the Amazon Redshift dashboard.
- Underneath Dashboards on the navigation sidebar, select Handle.
- Within the dashboards record, select Amazon Redshift.
The dashboard seem, exhibiting operational knowledge out of your cluster. Whenever you add extra clusters and create knowledge sources for them in Grafana, you may select them from the Information supply record on the dashboard.
To keep away from incurring pointless expenses, delete the Amazon Redshift cluster, AWS SSO consumer, and Amazon Managed Grafana workspace assets that you just created as a part of this resolution.
On this submit, we lined the method of organising an Amazon Redshift dashboard working beneath Amazon Managed Grafana with AWS SSO authentication and querying from the Amazon Redshift cluster beneath the identical AWS account. This is only one option to create the dashboard. You possibly can modify the method to set it up with SAML as an authentication methodology, use customized IAM roles to handle permissions with extra granularity, question Amazon Redshift clusters outdoors of the AWS account the place the Grafana workspace is, use an entry key and secret or AWS Secrets and techniques Supervisor primarily based connection credentials in knowledge sources, and extra. You too can customise the dashboard by including or altering visualizations utilizing the feature-rich Grafana UI.
As a result of the Amazon Redshift knowledge supply plugin is an open-source venture, you may set up it in any Grafana deployment, whether or not it’s within the cloud, on premises, and even in a container working in your laptop computer. That means that you can seamlessly combine Amazon Redshift monitoring into just about all of your present Grafana-based monitoring stacks.
For extra particulars concerning the programs and processes described on this submit, seek advice from the next:
In regards to the Authors
Milind Oke is a Information Warehouse Specialist Options Architect primarily based out of New York. He has been constructing knowledge warehouse options for over 15 years and makes a speciality of Amazon Redshift.