Check out our new Resources section: Read through our eBooks and learn how customers are using pganalyze. See all resources

Step 2: Create Monitoring User

We recommend creating a separate monitoring user on your PostgreSQL database for pganalyze.

As an RDS superuser, connect to the database you will be monitoring and run the following (we've generated a random password for you, but you can replace it with one of your choosing):

CREATE USER pganalyze WITH PASSWORD '[could not generate password]' CONNECTION LIMIT 5;
GRANT pg_monitor TO pganalyze;

CREATE SCHEMA pganalyze;
GRANT USAGE ON SCHEMA pganalyze TO pganalyze;
GRANT USAGE ON SCHEMA public TO pganalyze;

CREATE OR REPLACE FUNCTION pganalyze.get_stat_replication() RETURNS SETOF pg_stat_replication AS
$$
  /* pganalyze-collector */ SELECT * FROM pg_catalog.pg_stat_replication;
$$ LANGUAGE sql VOLATILE SECURITY DEFINER;

Note that it is important you run these as RDS superuser in order to pass down the full access to statistics tables.

Write down the username and password of the monitoring user, we will use it in the last step of this tutorial.


Next we continue by setting up the IAM policy:

Proceed to Step 3: Setup IAM Policy

Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →