Created
September 26, 2022 14:19
-
-
Save elyasha/ff5621a852de6f6586a0e883e0ebb170 to your computer and use it in GitHub Desktop.
Read only creation of a user for RDS postgres cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP ROLE IF EXISTS readaccess; | |
CREATE ROLE readaccess; | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
DROP USER IF EXISTS readonly; | |
CREATE USER readonly WITH PASSWORD 'secret'; | |
GRANT readaccess TO readonly; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment