Recently I was tasked with removing all of our secrets from secret manager that were in our 300+ lambdas and switch to using IAM auth by generating tokes instead of having secrets in our lambdas.
To implement Identity and Access Management (IAM) authentication to Amazon RDS for PostgreSQL, you can follow these steps:
Sign in to the AWS Management Console and open the Amazon RDS console.
Select the PostgreSQL instance you want to enable IAM authentication for.
Under the Configuration tab, select the IAM DB authentication option.
Select the Enable IAM DB authentication option and choose the IAM role that you want to use for authentication.
Click the Apply changes button to save the changes.
To connect to your PostgreSQL instance using IAM authentication, you will need to use the IAM credentials (access key and secret key) of the IAM user or role that you specified in step 4.
You can use the following connection string to connect to your PostgreSQL instance using IAM authentication:
postgresql://<IAM_USER>:<IAM_SECRET_KEY>@<RDS_ENDPOINT>:<RDS_PORT>/<DB_NAME> Replace <IAM_USER>, <IAM_SECRET_KEY>, <RDS_ENDPOINT>, <RDS_PORT>, and <DB_NAME> with the appropriate values for your setup.
With these steps, you should be able to enable and use IAM authentication for your Amazon RDS for PostgreSQL instance. Keep in mind that you will need to have the appropriate IAM permissions to perform these steps. You can find more detailed instructions in the Amazon RDS for PostgreSQL documentation. This is a very basic intro to the steps but should get you started. If you have any questions please just ask me!