Created
April 26, 2025 09:42
-
-
Save ycku/67dc18e2274e3863b8e02111c594b433 to your computer and use it in GitHub Desktop.
Connect RDS for PostgreSQL with Secret Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export RDSHOST="rds.hostname" | |
export SECRETID="secret-id" | |
export SECRETSTRING=$(aws secretsmanager get-secret-value --secret-id "${SECRETID}" --query SecretString --output text) | |
export PGHOST="${RDSHOST}" | |
export PGUSER=$(echo "${SECRETSTRING}" | jq -r '.username') | |
export PGPASSWORD=$(echo "${SECRETSTRING}" | jq -r '.password') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "secretsmanager:GetSecretValue", | |
"Resource": "secret-arn" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment