I am trying to enable some Postgres extensions to specific user in AWS RDS Postgres instance.
1) I have tried through deployment using rails migration, didnt work.
class InstallPgTrgmContribPackage < ActiveRecord::Migration[5.1]
def change
enable_extension "fuzzystrmatch"
enable_extension "pg_trgm"
enable_extension "unaccent"
# execute "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;"
# execute "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
# execute "CREATE EXTENSION IF NOT EXISTS unaccent;"
end
end
2) Also, tried through ssh-ing into postgres and create it from there.
psql -h blabla.us-east-1.rds.amazonaws.com -p 5432 -U prod -d prod
prod=> CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
returns: ERROR: permission denied to create extension "fuzzystrmatch"
HINT: Must be superuser to create this extension.
By default RDS instance role is test, and I am able to create extension in test user. I am trying to install in prod and dev users.

The rails application deployed through Elastic Beanstalk.
Question: How to add superuser privileges into new user role?
It seems like the prod user does not have superuser priviledges:
As stated from AWS Docs:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html
1. create role testuser with password 'testuser' login;
CREATE ROLE
2. grant rds_superuser to testuser;
GRANT ROLE
Point 1 has already been done as there is a prod user
Thus, you need to run point 2 command to grant priviledges.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With