Manage a login
Set or remove a login's expiry, rotate its password, or revoke it.
Replace ewdb-0123456789ab with your database's id and login-id with the login's id from
GET /rds/api/instances/{id}/logins.
Prerequisites
rds:ModifyDBLoginfor the expiry,rds:RotateDBLoginPasswordto rotate,rds:DeleteDBLoginto revoke;rds:DescribeDBLoginsto see the Logins tab.- The database is available. Otherwise the console's buttons are disabled and the API answers
409
This database is <status>. Logins can be changed once it is available. - In the console, also
rds:DescribeDBInstancesto open the database's page (without it the page is not found).
Set or remove the expiry
- Open the database, then choose Logins.
- On the login's row, choose Expiry.
- Choose 1 day, 7 days, 30 days (the default), 90 days or 1 year, then Set expiry. On a login that has an expiry, Remove expiry clears it. An exact date is set through the CLI, the API or Terraform.
dcloud rds logins modify ewdb-0123456789ab login-id --valid-until 2027-03-31T18:00:00ZPATCH /rds/api/instances/ewdb-0123456789ab/logins/3f8b6c2e-1d4a-4b7e-9c2f-5a6b7c8d9e0f
{ "validUntil": "2027-03-31T18:00:00Z" }null removes the expiry.
Set valid_until on the dcloud_db_login resource.
The expiry is the role's VALID UNTIL, any time from five minutes to two years ahead. After that
time Postgres refuses the password on both ports. Sessions that are still open are ended within
five minutes. An expiry outside that window is refused with 400
The expiry must be at least five minutes from now. or
The expiry can be at most two years from now.; to cut someone off now, revoke the login. An
expired login stays listed, marked expired, until you revoke it or give it a new expiry.
Rotate the password
- On the login's row, choose Rotate.
- Choose Rotate password, or Rotate and end sessions to also end the sessions the old password opened.
dcloud rds logins rotate-password ewdb-0123456789ab login-id --end-sessionsPOST /rds/api/instances/ewdb-0123456789ab/logins/3f8b6c2e-1d4a-4b7e-9c2f-5a6b7c8d9e0f/rotate
{ "endSessions": false }Not available in Terraform. Rotation is an action, not configuration.
The new password is filed as a new version of the same secret. The person who could reveal the old password reveals the new one. The old password is refused at the next connection, and sessions it opened keep running unless you end them. If the database refuses the new password, the secret goes back to the previous version and the old password keeps working.
Revoke the login
- On the login's row, choose Revoke.
- Choose Revoke to confirm.
dcloud rds logins delete ewdb-0123456789ab login-idDELETE /rds/api/instances/ewdb-0123456789ab/logins/3f8b6c2e-1d4a-4b7e-9c2f-5a6b7c8d9e0fRemove the dcloud_db_login resource and run terraform apply.
Result
Revoking ends the login's open sessions, drops its role (anything it owns in the database's own
database goes to the master user) and deletes its secret. A role already gone from the server is
removed from the list with a warning. Every change is on Activity (phase logins).
If a change is refused
- 409
The role “alice” is not on the server any more. Revoke the login and create it again.(expiry or rotation). - 409
The role “alice” on the server is not the one this login created, so it was left alone. - 409
The organization has no enabled encryption key, so the new password could not be filed in Secrets.(rotation).