Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename the Amazon RDS master username

Changing the password is easily done through the console. Is there any way to change the master username after creation on RDS for PostgreSQL? If so, how?

like image 847
Laura Avatar asked Apr 14 '15 17:04

Laura


People also ask

What is my AWS RDS master username?

Using AWS Console 04 Select the RDS instance that you want to examine. 05 Click Instance Actions button from the dashboard top menu and select See Details. 06 On the Details tab, in the Configuration Details section, check the Username attribute value. If the current value is set to "awsuser", i.e.

Can we rename RDS instance?

You can now change the name and endpoint of your existing DB Instances via the AWS Management Console, Amazon RDS API, or the Amazon RDS command line toolkit. DB instance renaming feature is available with all RDS-supported database engines (i.e. MySQL, Oracle, and SQL Server) and in all AWS regions.


4 Answers

You can't change username. You can check the following links that describe how to change master password and if Amazon adds the ability to change username you will find there:

Try to find at AWS CLI for RDS:

 modify-db-instance --db-instance-identifier <value> --master-user-password (string)

--master-user-password (string)

The new password for the DB instance master user. Can be any printable ASCII character except "/", """, or "@".

Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible. Between the time of the request and the completion of the request, the MasterUserPassword element exists in the PendingModifiedValues element of the operation response. Default: Uses existing setting

Constraints: Must be 8 to 41 alphanumeric characters (MySQL, MariaDB, and Amazon Aurora), 8 to 30 alphanumeric characters (Oracle), or 8 to 128 alphanumeric characters (SQL Server).

The Amazon RDS Command Line Interface (CLI) has been deprecated. Instead, use the AWS CLI for RDS.

Via the AWS Management Console, choose the instance you need to reset the password for, click ‘Modify’ then choose a new master password.

If you don’t want to use the AWS Console, you can use the rds-modify-db-instance command (as per Amazon’s documentation for RDS) to reset it directly, given the AWS command line tools: rds-modify-db-instance instance-name --master-user-password examplepassword

like image 131
Valeriy Solovyov Avatar answered Oct 05 '22 19:10

Valeriy Solovyov


No. As of April 2019 one cannot reset the 'master username'.

like image 36
funny_head Avatar answered Oct 05 '22 18:10

funny_head


You cannot do it directly. However you can use the database migration service from AWS:

https://aws.amazon.com/dms/

Essentially you define the current database instance as your source and the new database with the correct username as your target of the migration.

This way you migrate the data from one to another database instance. As such you can change all properties including the username.

This approach has some drawbacks:

  • You need to configure the migration. Which takes a bit of time.
  • The data is migrated. This may lead unexpected behavior since not everything is eventually migrated (e.g. views etc.)
  • It depends how you setup everything you may experience a downtime.
like image 39
Thomas Hunziker Avatar answered Oct 05 '22 18:10

Thomas Hunziker


Though this may not be ideal for every use-case, I did find a workaround that allows for changing the username of the master user of an AWS RDS DB.

I am using PgAdmin4 with PostgreSQL 14 at the time of writing this answer.

  1. Login with the master user you want to change the name of

  2. Create a new user with the following privileges and membership Privileges and Membership

  • Can login - yes
  • Superuser - no (not possible with a managed AWS RDS DB instance, if you need complete superuser access DO NOT use a managed AWS RDS DB)
  • Create roles - yes
  • Create databases - yes
  • Inherit rights from the parent roles - yes
  • Can initiate streaming replication and backups - no (again, not possible directly without superuser permission)

Be sure to note the password used, as you will need to access this new account at least 1 time to complete the name change

  1. Register a server with the credentials created in step 2. Disconnect from the server but do NOT remove it! Connect to the new server created

  2. Expand Login/Group Roles and click on the master user whom you are changing the name

  3. Click the edit icon, edit the name, and save.

  4. Right click the server with the master username, select Properties

  • Update the name under the General tab if desired
  • Update the username under the Connection tab to whatever you changed the master username above
  • Save and reconnect to the server with the master user

You have successfully updated the master user's name on a managed AWS RDS DB instance, proud of you!

like image 45
tdubs Avatar answered Oct 05 '22 20:10

tdubs