Access RDS databases via EKS with helm install #24116
stevenGravy
started this conversation in
Show and tell
Replies: 1 comment
-
I think the IAM trust policy should have a subject condition as well |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This steps through installing a helm chart with the required role to enable access to a RDS postgresql database via Teleport. This approach should work for other similar helm installs with similar role requirements.
Prerequisites:
postgres-aurora.cmkm1qh.us-east-1.rds.amazonaws.com:5432
) is available from the K8s cluster.jq
is used below to help collect infoaws
CLI toolThis assumes you have created users in the database such as the below for postgresql that can access via IAM.
Setup your role to enable access
Create your policy
Collect the region, AWS account and resource id. This policy will be used to allow the Teleport pods to access the RDS database.
From the database access guide:
The database resource ID is shown on the Configuration tab of a particular database instance in the RDS control panel, under "Resource id". For regular RDS database it starts with db- prefix. For Aurora, use the database cluster resource ID (cluster-), not the individual instance ID.
Create the policy
The
my-rds-policy
will be attached to your role.Collect your oidc issuer
Collect the last string (
44969AD34F07D62C3BE6ACCF41B4
as above).Create a role
Create the trust policy
The trust policy is used to match and allow assuming role with the web identity.
Create the role
Create a role with the trust policy and attach policy to access db.
AWS_ACCOUNT=1234567890 aws iam create-role --role-name my-rds-role --assume-role-policy-document file://trustpolicy.json aws iam attach-role-policy --policy-arn arn:aws:iam::${AWS_ACCOUNT}:policy/my-rds-policy --role-name my-rds-role
Install helm chart
Create a database token
tctl tokens add --type=db --format=text
Replace the values and create the
values.yaml
file.Install the helm chart to the Kubernetes cluster
Install the agent
Confirm connection
Confirm that the database is listed and can be connected
Create user
Connect
Troubleshooting
Here are typical things to check:
kubectl logs -f -n teleport-agent pods/teleport-agent-0
Beta Was this translation helpful? Give feedback.
All reactions