Skip to main content

rds-proxy-password-rotation

⚠️ Work in progress ⚠️

  • add Terraform module

Python script for multi-user password rotation using RDS and RDS proxy. It supports credentials for the application and the RDS proxy.

We implemented this logic again, because current implementations

  • have no tests
  • have no release process
  • are not published to PyPI
  • have no Docker image available
  • have no Terraform module available

Pre-requisites

  1. Python 3.10 or later

  2. For each db user:

    1. Clone the user in the database and grant the necessary permissions. We suggest to add a -clone suffix to the username.

    2. Create a secret in AWS Secrets Manager with the following key-value pairs (for every user and its clone):

      • rotation_type: "AWS RDS"
      • rotation_usernames: Optional. The list of usernames that a part of the rotation, e.g. ["app_user", "app_user-clone"]. If not provided, username is used only.
      • proxy_secret_ids: Optional. The list of ARNs of the secrets that are attached to the RDS Proxy, e.g. ["arn:aws:secretsmanager:region:account-id:secret:secret-name"]. If not provided, the proxy credentials are not adjusted.
      • database_host: The hostname of the database
      • database_port: The port of the database
      • database_name: The name of the database
      • username: The username for the user
      • password: The password for the user

      This credential will be used by the application to connect to the proxy. You may add additional key-value pairs as needed.

  3. If you are using RDS Proxy:

    1. Create a secret in AWS Secrets Manager with the following key-value pairs:
      • username: The username for the user that the proxy will use to connect to the database
      • password: The password for the user that the proxy will use to connect to the database
    2. Attach the secret to the RDS Proxy.
  4. The docker image can be pulled from GHCR:

    docker pull ghcr.io/Hapag-Lloyd/rds-proxy-password-rotation:edge
    

    ⚠️ The edge tag is used for the latest build. You SHOULD use a specific version tag in production.

Architecture

Architecture

Challenges with RDS and RDS Proxy

RDS Proxy is a fully managed, highly available database proxy for Amazon Relational Database Service (RDS) that makes applications more scalable, more resilient to database failures, and more secure. It allows applications to pool and share database connections to improve efficiency and reduce the load on your database instances.

However, RDS Proxy does not support multi-user password rotation out of the box. This script provides a solution to this problem.

Using an RDS Proxy requires a secret in AWS Secrets Manager with the credentials to connect to the database. This secret is used by the proxy to connect to the database. The proxy allows the application to connect to the database using the same credentials and then forwards the requests to the database with the same credentials. This means that the credentials in the secret must be valid in the database at all times. But what if you want to rotate the password for the user that the proxy uses to connect to the database? You can’t just update the secret in SecretsManager because the proxy will stop working as soon as the secret is updated. And you can’t just update the password in the database because the proxy will stop working as soon as the password is updated.

Why password rotation is a good practice

Password rotation is a good idea for several reasons:

  1. Enhanced Security: Regularly changing passwords reduces the risk of unauthorized access due to compromised credentials.
  2. Mitigates Risk: Limits the time window an attacker has to exploit a stolen password.
  3. Compliance: Many regulatory standards and security policies require periodic password changes.
  4. Reduces Impact of Breaches: If a password is compromised, rotating it ensures that the compromised password is no longer valid.
  5. Encourages Good Practices: Promotes the use of strong, unique passwords and discourages password reuse.

Metadata

Release files for rds-proxy-password-rotation 0.6.630

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rds-proxy-password-rotation 0.6.630
File Size Uploaded
rds_proxy_password_rotation-0.6.630.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rds-proxy-password-rotation 0.6.630
File Interpreter ABI Platform
rds_proxy_password_rotation-0.6.630-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / rds_proxy_password_rotation-0.6.630.tar.gz

Download URL rds_proxy_password_rotation-0.6.630.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
68dea6d5984b34fe76e85a82847fe5b998845ce43b8093cd9719319bbbd0c4ea
BLAKE2b-256 checksum
How to use checksums
3b39d00823b4c04426d98334adf6889a66a4bafab4a0fa13d4332b8f98281719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / rds_proxy_password_rotation-0.6.630-py3-none-any.whl

Download URL rds_proxy_password_rotation-0.6.630-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5efe733ed5d44fec4b932c4376270b165f1d89a4672295990a092ab9ed4e7863
BLAKE2b-256 checksum
How to use checksums
c1793d2017937feaf61784d19c5b61971df893f837f7ec583080cf0f2185428c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.630 This release

2 release files

0.6.99

2 release files

0.6.98

2 release files

0.6.97

2 release files

0.6.96

2 release files

0.6.95

2 release files

0.6.94

2 release files

0.6.93

2 release files

0.6.92

2 release files

0.6.91

2 release files

0.6.90

2 release files

0.6.89

2 release files

0.6.88

2 release files

0.6.87

2 release files

0.6.86

2 release files

0.6.85

2 release files

0.6.84

2 release files

0.6.83

2 release files

0.6.82

2 release files

0.6.81

2 release files

0.6.80

2 release files

0.6.79

2 release files

0.6.78

2 release files

0.6.77

2 release files

0.6.76

2 release files

0.6.75

2 release files

0.6.60

2 release files

0.6.59

2 release files

0.6.58

2 release files

0.6.57

2 release files

0.6.56

2 release files

0.6.55

2 release files

0.6.54

2 release files

0.6.53

2 release files

0.6.52

2 release files

0.6.51

2 release files

0.6.50

2 release files

0.6.49

2 release files

0.6.48

2 release files

0.6.47

2 release files

0.6.46

2 release files

0.6.45

2 release files

0.6.44

2 release files

0.6.43

2 release files

0.6.42

2 release files

0.6.41

2 release files

0.6.40

2 release files

0.6.39

2 release files

0.6.38

2 release files

0.6.37

2 release files

0.6.36

2 release files

0.6.35

2 release files

0.6.34

2 release files

0.6.33

2 release files

0.6.32

2 release files

0.6.31

2 release files

0.6.30

2 release files

0.6.29

2 release files

0.6.28

2 release files

0.6.27

2 release files

0.6.26

2 release files

0.6.25

2 release files

0.6.24

2 release files

0.6.23

2 release files

0.6.21

2 release files

0.6.20

2 release files

0.6.19

2 release files

0.6.18

2 release files

0.6.17

2 release files

0.6.16

2 release files

0.6.15

2 release files

0.6.14

2 release files

0.6.13

2 release files

0.6.12

2 release files

0.6.11

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page