How To Migrate PostgreSQL Users To AWS RDS PostgreSQL](/assets/How-To-Migrate-PostgreSQL-Users-To-AWS-RDS-PostgreSQL.jpg)
According to PostgreSQL migration, we can migrate the databases and tables. I was migrating a Postgresql environment from EC2 to RDS Postgresql. I have completed the data migration. In many blogs, they have mentioned the steps to migrate PostgreSQL users to another server. But in RDS I couldn’t able to do that. I got the below error.
It seems we can’t directly import the users because few users had superuser role. So we need to do some sanitization to migrate the users.
The roles that are not supported in RDS:
So we need to remove these roles in the import file. Here are the complete steps for migrating PostgreSQL user to RDS.
Dump out the users:
Directly Import to another PostgreSQL servers(Ec2/On-Prem):
Importing to AWS RDS PostgreSQL: