Grafana Cloud Enterprise
Last reviewed: July 23, 2026

Amazon Aurora template variables

Use template variables with the Amazon Aurora data source to create dynamic, reusable dashboards. Instead of hard-coding values such as table names or filter values in your queries, you can use variables that users change from drop-downs at the top of the dashboard.

Before you begin

Supported variable types

The Amazon Aurora data source works with the following variable types:

Variable typeSupported
QueryYes
CustomYes
ConstantYes
Data sourceYes
IntervalYes
Ad hoc filtersNo

Create a query variable

Query variables populate their options by running an SQL query against your Aurora cluster. The variable query editor provides the same SQL editor and macro support as the regular query editor, including the Format data frames as drop-down.

To create a query variable:

  1. Navigate to Dashboard settings > Variables.
  2. Click Add variable.
  3. Select Query as the variable type.
  4. Select your Amazon Aurora data source.
  5. Enter an SQL query in the query editor.
  6. Click Run query to preview the variable options.
  7. Click Apply.

Query examples

Return all table names in a PostgreSQL-compatible database:

SQL
select table_name from information_schema.tables where table_schema = 'public'

Return all table names in the current MySQL-compatible database:

SQL
select table_name from information_schema.tables where table_schema = database()

Return distinct values from a column:

SQL
select distinct city from weather_readings

Custom display names

To display a user-friendly label in the drop-down while using a different value in queries, alias the columns as text and value:

SQL
select city_name as text, city_id as value from cities

In this example, the variable drop-down shows city names, but queries use the city_id value.

Use variables in queries

Reference a variable in any Aurora query with the $variable or ${variable} syntax. Grafana interpolates the variable value before sending the query to your database. For example, with a variable named tableName, you can reuse the same panel across multiple tables:

SQL
select * from $tableName limit 3;

For more interpolation options, refer to Variable syntax.

Multi-value variables

When a variable allows multiple selections, use a format option so the values interpolate into valid SQL. Without a format option, Grafana renders multiple values as {value1,value2}, which isn’t valid SQL. Use singlequote for string columns:

SQL
select recorded_at, temperature
from weather_readings
where city in (${city:singlequote})

With New York and Toronto selected, the query becomes where city in ('New York','Toronto'). For numeric columns, use ${variable:csv} instead.

Create cascading variables

You can create dependent variables where one variable’s options depend on another variable’s selection. For example, create a city variable first, then create a neighborhood variable that queries values for the selected city:

SQL
select distinct neighborhood from weather_readings where city = ${city:singlequote}

When the user changes the city selection, the neighborhood options refresh automatically.

Note

Template variables don’t work with Grafana Alerting. Alert rule queries must not reference dashboard variables.

Next steps