简体   繁体   中英

AWS RDS Extension Installation

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM